Text Compare
Produced: 7/19/2015 1:51:24 PM
   
Mode:  All, With Context  
Left file: C:\mksong\workspace_genproglase\genproglase-output-r1658\template08\0718-1345\valgrind-bug-11621-11622\sanity\helgrind\hg_main.c  
Right file: C:\mksong\workspace_genproglase\genproglase-output-r1658\template08\0718-1345\valgrind-bug-11621-11622\000000\helgrind\hg_main.c  
1 typedef unsigned char UChar; = 1 typedef unsigned char UChar;
2 typedef signed char Char;   2 typedef signed char Char;
3 typedef char HChar;   3 typedef char HChar;
4 typedef unsigned short UShort;   4 typedef unsigned short UShort;
5 typedef short Short;   5 typedef short Short;
6 typedef unsigned int UInt;   6 typedef unsigned int UInt;
7 typedef int Int;   7 typedef int Int;
8 typedef unsigned long long ULong;   8 typedef unsigned long long ULong;
9 typedef long long Long;   9 typedef long long Long;
10 typedef UInt U128[4];   10 typedef UInt U128[4];
11 union __anonunion_V128_1 {   11 union __anonunion_V128_1 {
12    UChar w8[16] ;   12    UChar w8[16] ;
13    UShort w16[8] ;   13    UShort w16[8] ;
14    UInt w32[4] ;   14    UInt w32[4] ;
15    ULong w64[2] ;   15    ULong w64[2] ;
16 };   16 };
17 typedef union __anonunion_V128_1 V128;   17 typedef union __anonunion_V128_1 V128;
18 typedef float Float;   18 typedef float Float;
19 typedef double Double;   19 typedef double Double;
20 typedef unsigned char Bool;   20 typedef unsigned char Bool;
21 typedef UInt Addr32;   21 typedef UInt Addr32;
22 typedef ULong Addr64;   22 typedef ULong Addr64;
23 typedef unsigned long HWord;   23 typedef unsigned long HWord;
24 typedef __builtin_va_list __gnuc_va_list;   24 typedef __builtin_va_list __gnuc_va_list;
25 typedef __gnuc_va_list va_list;   25 typedef __gnuc_va_list va_list;
26 typedef unsigned long UWord;   26 typedef unsigned long UWord;
27 typedef long Word;   27 typedef long Word;
28 typedef UWord Addr;   28 typedef UWord Addr;
29 typedef UWord AddrH;   29 typedef UWord AddrH;
30 typedef UWord SizeT;   30 typedef UWord SizeT;
31 typedef Word SSizeT;   31 typedef Word SSizeT;
32 typedef Word PtrdiffT;   32 typedef Word PtrdiffT;
33 typedef Word OffT;   33 typedef Word OffT;
34 typedef Long Off64T;   34 typedef Long Off64T;
35 struct __anonstruct_UWordPair_2 {   35 struct __anonstruct_UWordPair_2 {
36    UWord uw1 ;   36    UWord uw1 ;
37    UWord uw2 ;   37    UWord uw2 ;
38 };   38 };
39 typedef struct __anonstruct_UWordPair_2 UWordPair;   39 typedef struct __anonstruct_UWordPair_2 UWordPair;
40 typedef UInt ThreadId;   40 typedef UInt ThreadId;
41 struct __anonstruct_SysRes_3 {   41 struct __anonstruct_SysRes_3 {
42    UWord _val ;   42    UWord _val ;
43    Bool _isError ;   43    Bool _isError ;
44 };   44 };
45 typedef struct __anonstruct_SysRes_3 SysRes;   45 typedef struct __anonstruct_SysRes_3 SysRes;
46 enum __anonenum_VgMsgKind_4 {   46 enum __anonenum_VgMsgKind_4 {
47     Vg_FailMsg = 0,   47     Vg_FailMsg = 0,
48     Vg_UserMsg = 1,   48     Vg_UserMsg = 1,
49     Vg_DebugMsg = 2,   49     Vg_DebugMsg = 2,
50     Vg_ClientMsg = 3   50     Vg_ClientMsg = 3
51 } ;   51 } ;
52 typedef enum __anonenum_VgMsgKind_4 VgMsgKind;   52 typedef enum __anonenum_VgMsgKind_4 VgMsgKind;
53 struct _ExeContext;   53 struct _ExeContext;
54 typedef struct _ExeContext ExeContext;   54 typedef struct _ExeContext ExeContext;
55 enum __anonenum_VgRes_5 {   55 enum __anonenum_VgRes_5 {
56     Vg_LowRes = 0,   56     Vg_LowRes = 0,
57     Vg_MedRes = 1,   57     Vg_MedRes = 1,
58     Vg_HighRes = 2   58     Vg_HighRes = 2
59 } ;   59 } ;
60 typedef enum __anonenum_VgRes_5 VgRes;   60 typedef enum __anonenum_VgRes_5 VgRes;
61 typedef Int ErrorKind;   61 typedef Int ErrorKind;
62 struct _Error;   62 struct _Error;
63 typedef struct _Error Error;   63 typedef struct _Error Error;
64 typedef Int SuppKind;   64 typedef Int SuppKind;
65 struct _Supp;   65 struct _Supp;
66 typedef struct _Supp Supp;   66 typedef struct _Supp Supp;
67 enum __anonenum_IRType_6 {   67 enum __anonenum_IRType_6 {
68     Ity_INVALID = 69632,   68     Ity_INVALID = 69632,
69     Ity_I1 = 69633,   69     Ity_I1 = 69633,
70     Ity_I8 = 69634,   70     Ity_I8 = 69634,
71     Ity_I16 = 69635,   71     Ity_I16 = 69635,
72     Ity_I32 = 69636,   72     Ity_I32 = 69636,
73     Ity_I64 = 69637,   73     Ity_I64 = 69637,
74     Ity_I128 = 69638,   74     Ity_I128 = 69638,
75     Ity_F32 = 69639,   75     Ity_F32 = 69639,
76     Ity_F64 = 69640,   76     Ity_F64 = 69640,
77     Ity_F128 = 69641,   77     Ity_F128 = 69641,
78     Ity_V128 = 69642   78     Ity_V128 = 69642
79 } ;   79 } ;
80 typedef enum __anonenum_IRType_6 IRType;   80 typedef enum __anonenum_IRType_6 IRType;
81 enum __anonenum_IREndness_7 {   81 enum __anonenum_IREndness_7 {
82     Iend_LE = 73728,   82     Iend_LE = 73728,
83     Iend_BE = 73729   83     Iend_BE = 73729
84 } ;   84 } ;
85 typedef enum __anonenum_IREndness_7 IREndness;   85 typedef enum __anonenum_IREndness_7 IREndness;
86 enum __anonenum_IRConstTag_8 {   86 enum __anonenum_IRConstTag_8 {
87     Ico_U1 = 77824,   87     Ico_U1 = 77824,
88     Ico_U8 = 77825,   88     Ico_U8 = 77825,
89     Ico_U16 = 77826,   89     Ico_U16 = 77826,
90     Ico_U32 = 77827,   90     Ico_U32 = 77827,
91     Ico_U64 = 77828,   91     Ico_U64 = 77828,
92     Ico_F32 = 77829,   92     Ico_F32 = 77829,
93     Ico_F32i = 77830,   93     Ico_F32i = 77830,
94     Ico_F64 = 77831,   94     Ico_F64 = 77831,
95     Ico_F64i = 77832,   95     Ico_F64i = 77832,
96     Ico_V128 = 77833   96     Ico_V128 = 77833
97 } ;   97 } ;
98 typedef enum __anonenum_IRConstTag_8 IRConstTag;   98 typedef enum __anonenum_IRConstTag_8 IRConstTag;
99 union __anonunion_Ico_9 {   99 union __anonunion_Ico_9 {
100    Bool U1 ;   100    Bool U1 ;
101    UChar U8 ;   101    UChar U8 ;
102    UShort U16 ;   102    UShort U16 ;
103    UInt U32 ;   103    UInt U32 ;
104    ULong U64 ;   104    ULong U64 ;
105    Float F32 ;   105    Float F32 ;
106    UInt F32i ;   106    UInt F32i ;
107    Double F64 ;   107    Double F64 ;
108    ULong F64i ;   108    ULong F64i ;
109    UShort V128 ;   109    UShort V128 ;
110 };   110 };
111 struct _IRConst {   111 struct _IRConst {
112    IRConstTag tag ;   112    IRConstTag tag ;
113    union __anonunion_Ico_9 Ico ;   113    union __anonunion_Ico_9 Ico ;
114 };   114 };
115 typedef struct _IRConst IRConst;   115 typedef struct _IRConst IRConst;
116 struct __anonstruct_IRCallee_10 {   116 struct __anonstruct_IRCallee_10 {
117    Int regparms ;   117    Int regparms ;
118    HChar *name ;   118    HChar *name ;
119    void *addr ;   119    void *addr ;
120    UInt mcx_mask ;   120    UInt mcx_mask ;
121 };   121 };
122 typedef struct __anonstruct_IRCallee_10 IRCallee;   122 typedef struct __anonstruct_IRCallee_10 IRCallee;
123 struct __anonstruct_IRRegArray_11 {   123 struct __anonstruct_IRRegArray_11 {
124    Int base ;   124    Int base ;
125    IRType elemTy ;   125    IRType elemTy ;
126    Int nElems ;   126    Int nElems ;
127 };   127 };
128 typedef struct __anonstruct_IRRegArray_11 IRRegArray;   128 typedef struct __anonstruct_IRRegArray_11 IRRegArray;
129 typedef UInt IRTemp;   129 typedef UInt IRTemp;
130 enum __anonenum_IROp_12 {   130 enum __anonenum_IROp_12 {
131     Iop_INVALID = 81920,   131     Iop_INVALID = 81920,
132     Iop_Add8 = 81921,   132     Iop_Add8 = 81921,
133     Iop_Add16 = 81922,   133     Iop_Add16 = 81922,
134     Iop_Add32 = 81923,   134     Iop_Add32 = 81923,
135     Iop_Add64 = 81924,   135     Iop_Add64 = 81924,
136     Iop_Sub8 = 81925,   136     Iop_Sub8 = 81925,
137     Iop_Sub16 = 81926,   137     Iop_Sub16 = 81926,
138     Iop_Sub32 = 81927,   138     Iop_Sub32 = 81927,
139     Iop_Sub64 = 81928,   139     Iop_Sub64 = 81928,
140     Iop_Mul8 = 81929,   140     Iop_Mul8 = 81929,
141     Iop_Mul16 = 81930,   141     Iop_Mul16 = 81930,
142     Iop_Mul32 = 81931,   142     Iop_Mul32 = 81931,
143     Iop_Mul64 = 81932,   143     Iop_Mul64 = 81932,
144     Iop_Or8 = 81933,   144     Iop_Or8 = 81933,
145     Iop_Or16 = 81934,   145     Iop_Or16 = 81934,
146     Iop_Or32 = 81935,   146     Iop_Or32 = 81935,
147     Iop_Or64 = 81936,   147     Iop_Or64 = 81936,
148     Iop_And8 = 81937,   148     Iop_And8 = 81937,
149     Iop_And16 = 81938,   149     Iop_And16 = 81938,
150     Iop_And32 = 81939,   150     Iop_And32 = 81939,
151     Iop_And64 = 81940,   151     Iop_And64 = 81940,
152     Iop_Xor8 = 81941,   152     Iop_Xor8 = 81941,
153     Iop_Xor16 = 81942,   153     Iop_Xor16 = 81942,
154     Iop_Xor32 = 81943,   154     Iop_Xor32 = 81943,
155     Iop_Xor64 = 81944,   155     Iop_Xor64 = 81944,
156     Iop_Shl8 = 81945,   156     Iop_Shl8 = 81945,
157     Iop_Shl16 = 81946,   157     Iop_Shl16 = 81946,
158     Iop_Shl32 = 81947,   158     Iop_Shl32 = 81947,
159     Iop_Shl64 = 81948,   159     Iop_Shl64 = 81948,
160     Iop_Shr8 = 81949,   160     Iop_Shr8 = 81949,
161     Iop_Shr16 = 81950,   161     Iop_Shr16 = 81950,
162     Iop_Shr32 = 81951,   162     Iop_Shr32 = 81951,
163     Iop_Shr64 = 81952,   163     Iop_Shr64 = 81952,
164     Iop_Sar8 = 81953,   164     Iop_Sar8 = 81953,
165     Iop_Sar16 = 81954,   165     Iop_Sar16 = 81954,
166     Iop_Sar32 = 81955,   166     Iop_Sar32 = 81955,
167     Iop_Sar64 = 81956,   167     Iop_Sar64 = 81956,
168     Iop_CmpEQ8 = 81957,   168     Iop_CmpEQ8 = 81957,
169     Iop_CmpEQ16 = 81958,   169     Iop_CmpEQ16 = 81958,
170     Iop_CmpEQ32 = 81959,   170     Iop_CmpEQ32 = 81959,
171     Iop_CmpEQ64 = 81960,   171     Iop_CmpEQ64 = 81960,
172     Iop_CmpNE8 = 81961,   172     Iop_CmpNE8 = 81961,
173     Iop_CmpNE16 = 81962,   173     Iop_CmpNE16 = 81962,
174     Iop_CmpNE32 = 81963,   174     Iop_CmpNE32 = 81963,
175     Iop_CmpNE64 = 81964,   175     Iop_CmpNE64 = 81964,
176     Iop_Not8 = 81965,   176     Iop_Not8 = 81965,
177     Iop_Not16 = 81966,   177     Iop_Not16 = 81966,
178     Iop_Not32 = 81967,   178     Iop_Not32 = 81967,
179     Iop_Not64 = 81968,   179     Iop_Not64 = 81968,
180     Iop_CasCmpEQ8 = 81969,   180     Iop_CasCmpEQ8 = 81969,
181     Iop_CasCmpEQ16 = 81970,   181     Iop_CasCmpEQ16 = 81970,
182     Iop_CasCmpEQ32 = 81971,   182     Iop_CasCmpEQ32 = 81971,
183     Iop_CasCmpEQ64 = 81972,   183     Iop_CasCmpEQ64 = 81972,
184     Iop_CasCmpNE8 = 81973,   184     Iop_CasCmpNE8 = 81973,
185     Iop_CasCmpNE16 = 81974,   185     Iop_CasCmpNE16 = 81974,
186     Iop_CasCmpNE32 = 81975,   186     Iop_CasCmpNE32 = 81975,
187     Iop_CasCmpNE64 = 81976,   187     Iop_CasCmpNE64 = 81976,
188     Iop_MullS8 = 81977,   188     Iop_MullS8 = 81977,
189     Iop_MullS16 = 81978,   189     Iop_MullS16 = 81978,
190     Iop_MullS32 = 81979,   190     Iop_MullS32 = 81979,
191     Iop_MullS64 = 81980,   191     Iop_MullS64 = 81980,
192     Iop_MullU8 = 81981,   192     Iop_MullU8 = 81981,
193     Iop_MullU16 = 81982,   193     Iop_MullU16 = 81982,
194     Iop_MullU32 = 81983,   194     Iop_MullU32 = 81983,
195     Iop_MullU64 = 81984,   195     Iop_MullU64 = 81984,
196     Iop_Clz64 = 81985,   196     Iop_Clz64 = 81985,
197     Iop_Clz32 = 81986,   197     Iop_Clz32 = 81986,
198     Iop_Ctz64 = 81987,   198     Iop_Ctz64 = 81987,
199     Iop_Ctz32 = 81988,   199     Iop_Ctz32 = 81988,
200     Iop_CmpLT32S = 81989,   200     Iop_CmpLT32S = 81989,
201     Iop_CmpLT64S = 81990,   201     Iop_CmpLT64S = 81990,
202     Iop_CmpLE32S = 81991,   202     Iop_CmpLE32S = 81991,
203     Iop_CmpLE64S = 81992,   203     Iop_CmpLE64S = 81992,
204     Iop_CmpLT32U = 81993,   204     Iop_CmpLT32U = 81993,
205     Iop_CmpLT64U = 81994,   205     Iop_CmpLT64U = 81994,
206     Iop_CmpLE32U = 81995,   206     Iop_CmpLE32U = 81995,
207     Iop_CmpLE64U = 81996,   207     Iop_CmpLE64U = 81996,
208     Iop_CmpNEZ8 = 81997,   208     Iop_CmpNEZ8 = 81997,
209     Iop_CmpNEZ16 = 81998,   209     Iop_CmpNEZ16 = 81998,
210     Iop_CmpNEZ32 = 81999,   210     Iop_CmpNEZ32 = 81999,
211     Iop_CmpNEZ64 = 82000,   211     Iop_CmpNEZ64 = 82000,
212     Iop_CmpwNEZ32 = 82001,   212     Iop_CmpwNEZ32 = 82001,
213     Iop_CmpwNEZ64 = 82002,   213     Iop_CmpwNEZ64 = 82002,
214     Iop_Left8 = 82003,   214     Iop_Left8 = 82003,
215     Iop_Left16 = 82004,   215     Iop_Left16 = 82004,
216     Iop_Left32 = 82005,   216     Iop_Left32 = 82005,
217     Iop_Left64 = 82006,   217     Iop_Left64 = 82006,
218     Iop_Max32U = 82007,   218     Iop_Max32U = 82007,
219     Iop_CmpORD32U = 82008,   219     Iop_CmpORD32U = 82008,
220     Iop_CmpORD64U = 82009,   220     Iop_CmpORD64U = 82009,
221     Iop_CmpORD32S = 82010,   221     Iop_CmpORD32S = 82010,
222     Iop_CmpORD64S = 82011,   222     Iop_CmpORD64S = 82011,
223     Iop_DivU32 = 82012,   223     Iop_DivU32 = 82012,
224     Iop_DivS32 = 82013,   224     Iop_DivS32 = 82013,
225     Iop_DivU64 = 82014,   225     Iop_DivU64 = 82014,
226     Iop_DivS64 = 82015,   226     Iop_DivS64 = 82015,
227     Iop_DivModU64to32 = 82016,   227     Iop_DivModU64to32 = 82016,
228     Iop_DivModS64to32 = 82017,   228     Iop_DivModS64to32 = 82017,
229     Iop_DivModU128to64 = 82018,   229     Iop_DivModU128to64 = 82018,
230     Iop_DivModS128to64 = 82019,   230     Iop_DivModS128to64 = 82019,
231     Iop_DivModS64to64 = 82020,   231     Iop_DivModS64to64 = 82020,
232     Iop_8Uto16 = 82021,   232     Iop_8Uto16 = 82021,
233     Iop_8Uto32 = 82022,   233     Iop_8Uto32 = 82022,
234     Iop_8Uto64 = 82023,   234     Iop_8Uto64 = 82023,
235     Iop_16Uto32 = 82024,   235     Iop_16Uto32 = 82024,
236     Iop_16Uto64 = 82025,   236     Iop_16Uto64 = 82025,
237     Iop_32Uto64 = 82026,   237     Iop_32Uto64 = 82026,
238     Iop_8Sto16 = 82027,   238     Iop_8Sto16 = 82027,
239     Iop_8Sto32 = 82028,   239     Iop_8Sto32 = 82028,
240     Iop_8Sto64 = 82029,   240     Iop_8Sto64 = 82029,
241     Iop_16Sto32 = 82030,   241     Iop_16Sto32 = 82030,
242     Iop_16Sto64 = 82031,   242     Iop_16Sto64 = 82031,
243     Iop_32Sto64 = 82032,   243     Iop_32Sto64 = 82032,
244     Iop_64to8 = 82033,   244     Iop_64to8 = 82033,
245     Iop_32to8 = 82034,   245     Iop_32to8 = 82034,
246     Iop_64to16 = 82035,   246     Iop_64to16 = 82035,
247     Iop_16to8 = 82036,   247     Iop_16to8 = 82036,
248     Iop_16HIto8 = 82037,   248     Iop_16HIto8 = 82037,
249     Iop_8HLto16 = 82038,   249     Iop_8HLto16 = 82038,
250     Iop_32to16 = 82039,   250     Iop_32to16 = 82039,
251     Iop_32HIto16 = 82040,   251     Iop_32HIto16 = 82040,
252     Iop_16HLto32 = 82041,   252     Iop_16HLto32 = 82041,
253     Iop_64to32 = 82042,   253     Iop_64to32 = 82042,
254     Iop_64HIto32 = 82043,   254     Iop_64HIto32 = 82043,
255     Iop_32HLto64 = 82044,   255     Iop_32HLto64 = 82044,
256     Iop_128to64 = 82045,   256     Iop_128to64 = 82045,
257     Iop_128HIto64 = 82046,   257     Iop_128HIto64 = 82046,
258     Iop_64HLto128 = 82047,   258     Iop_64HLto128 = 82047,
259     Iop_Not1 = 82048,   259     Iop_Not1 = 82048,
260     Iop_32to1 = 82049,   260     Iop_32to1 = 82049,
261     Iop_64to1 = 82050,   261     Iop_64to1 = 82050,
262     Iop_1Uto8 = 82051,   262     Iop_1Uto8 = 82051,
263     Iop_1Uto32 = 82052,   263     Iop_1Uto32 = 82052,
264     Iop_1Uto64 = 82053,   264     Iop_1Uto64 = 82053,
265     Iop_1Sto8 = 82054,   265     Iop_1Sto8 = 82054,
266     Iop_1Sto16 = 82055,   266     Iop_1Sto16 = 82055,
267     Iop_1Sto32 = 82056,   267     Iop_1Sto32 = 82056,
268     Iop_1Sto64 = 82057,   268     Iop_1Sto64 = 82057,
269     Iop_AddF64 = 82058,   269     Iop_AddF64 = 82058,
270     Iop_SubF64 = 82059,   270     Iop_SubF64 = 82059,
271     Iop_MulF64 = 82060,   271     Iop_MulF64 = 82060,
272     Iop_DivF64 = 82061,   272     Iop_DivF64 = 82061,
273     Iop_AddF32 = 82062,   273     Iop_AddF32 = 82062,
274     Iop_SubF32 = 82063,   274     Iop_SubF32 = 82063,
275     Iop_MulF32 = 82064,   275     Iop_MulF32 = 82064,
276     Iop_DivF32 = 82065,   276     Iop_DivF32 = 82065,
277     Iop_AddF64r32 = 82066,   277     Iop_AddF64r32 = 82066,
278     Iop_SubF64r32 = 82067,   278     Iop_SubF64r32 = 82067,
279     Iop_MulF64r32 = 82068,   279     Iop_MulF64r32 = 82068,
280     Iop_DivF64r32 = 82069,   280     Iop_DivF64r32 = 82069,
281     Iop_NegF64 = 82070,   281     Iop_NegF64 = 82070,
282     Iop_AbsF64 = 82071,   282     Iop_AbsF64 = 82071,
283     Iop_NegF32 = 82072,   283     Iop_NegF32 = 82072,
284     Iop_AbsF32 = 82073,   284     Iop_AbsF32 = 82073,
285     Iop_SqrtF64 = 82074,   285     Iop_SqrtF64 = 82074,
286     Iop_SqrtF64r32 = 82075,   286     Iop_SqrtF64r32 = 82075,
287     Iop_SqrtF32 = 82076,   287     Iop_SqrtF32 = 82076,
288     Iop_CmpF64 = 82077,   288     Iop_CmpF64 = 82077,
289     Iop_CmpF32 = 82078,   289     Iop_CmpF32 = 82078,
290     Iop_CmpF128 = 82079,   290     Iop_CmpF128 = 82079,
291     Iop_F64toI16S = 82080,   291     Iop_F64toI16S = 82080,
292     Iop_F64toI32S = 82081,   292     Iop_F64toI32S = 82081,
293     Iop_F64toI64S = 82082,   293     Iop_F64toI64S = 82082,
294     Iop_F64toI32U = 82083,   294     Iop_F64toI32U = 82083,
295     Iop_I16StoF64 = 82084,   295     Iop_I16StoF64 = 82084,
296     Iop_I32StoF64 = 82085,   296     Iop_I32StoF64 = 82085,
297     Iop_I64StoF64 = 82086,   297     Iop_I64StoF64 = 82086,
298     Iop_I32UtoF64 = 82087,   298     Iop_I32UtoF64 = 82087,
299     Iop_F32toI16S = 82088,   299     Iop_F32toI16S = 82088,
300     Iop_F32toI32S = 82089,   300     Iop_F32toI32S = 82089,
301     Iop_F32toI64S = 82090,   301     Iop_F32toI64S = 82090,
302     Iop_I16StoF32 = 82091,   302     Iop_I16StoF32 = 82091,
303     Iop_I32StoF32 = 82092,   303     Iop_I32StoF32 = 82092,
304     Iop_I64StoF32 = 82093,   304     Iop_I64StoF32 = 82093,
305     Iop_F32toF64 = 82094,   305     Iop_F32toF64 = 82094,
306     Iop_F64toF32 = 82095,   306     Iop_F64toF32 = 82095,
307     Iop_ReinterpF64asI64 = 82096,   307     Iop_ReinterpF64asI64 = 82096,
308     Iop_ReinterpI64asF64 = 82097,   308     Iop_ReinterpI64asF64 = 82097,
309     Iop_ReinterpF32asI32 = 82098,   309     Iop_ReinterpF32asI32 = 82098,
310     Iop_ReinterpI32asF32 = 82099,   310     Iop_ReinterpI32asF32 = 82099,
311     Iop_F64HLtoF128 = 82100,   311     Iop_F64HLtoF128 = 82100,
312     Iop_F128HItoF64 = 82101,   312     Iop_F128HItoF64 = 82101,
313     Iop_F128LOtoF64 = 82102,   313     Iop_F128LOtoF64 = 82102,
314     Iop_AddF128 = 82103,   314     Iop_AddF128 = 82103,
315     Iop_SubF128 = 82104,   315     Iop_SubF128 = 82104,
316     Iop_MulF128 = 82105,   316     Iop_MulF128 = 82105,
317     Iop_DivF128 = 82106,   317     Iop_DivF128 = 82106,
318     Iop_NegF128 = 82107,   318     Iop_NegF128 = 82107,
319     Iop_AbsF128 = 82108,   319     Iop_AbsF128 = 82108,
320     Iop_SqrtF128 = 82109,   320     Iop_SqrtF128 = 82109,
321     Iop_I32StoF128 = 82110,   321     Iop_I32StoF128 = 82110,
322     Iop_I64StoF128 = 82111,   322     Iop_I64StoF128 = 82111,
323     Iop_F32toF128 = 82112,   323     Iop_F32toF128 = 82112,
324     Iop_F64toF128 = 82113,   324     Iop_F64toF128 = 82113,
325     Iop_F128toI32S = 82114,   325     Iop_F128toI32S = 82114,
326     Iop_F128toI64S = 82115,   326     Iop_F128toI64S = 82115,
327     Iop_F128toF64 = 82116,   327     Iop_F128toF64 = 82116,
328     Iop_F128toF32 = 82117,   328     Iop_F128toF32 = 82117,
329     Iop_AtanF64 = 82118,   329     Iop_AtanF64 = 82118,
330     Iop_Yl2xF64 = 82119,   330     Iop_Yl2xF64 = 82119,
331     Iop_Yl2xp1F64 = 82120,   331     Iop_Yl2xp1F64 = 82120,
332     Iop_PRemF64 = 82121,   332     Iop_PRemF64 = 82121,
333     Iop_PRemC3210F64 = 82122,   333     Iop_PRemC3210F64 = 82122,
334     Iop_PRem1F64 = 82123,   334     Iop_PRem1F64 = 82123,
335     Iop_PRem1C3210F64 = 82124,   335     Iop_PRem1C3210F64 = 82124,
336     Iop_ScaleF64 = 82125,   336     Iop_ScaleF64 = 82125,
337     Iop_SinF64 = 82126,   337     Iop_SinF64 = 82126,
338     Iop_CosF64 = 82127,   338     Iop_CosF64 = 82127,
339     Iop_TanF64 = 82128,   339     Iop_TanF64 = 82128,
340     Iop_2xm1F64 = 82129,   340     Iop_2xm1F64 = 82129,
341     Iop_RoundF64toInt = 82130,   341     Iop_RoundF64toInt = 82130,
342     Iop_RoundF32toInt = 82131,   342     Iop_RoundF32toInt = 82131,
343     Iop_MAddF32 = 82132,   343     Iop_MAddF32 = 82132,
344     Iop_MSubF32 = 82133,   344     Iop_MSubF32 = 82133,
345     Iop_MAddF64 = 82134,   345     Iop_MAddF64 = 82134,
346     Iop_MSubF64 = 82135,   346     Iop_MSubF64 = 82135,
347     Iop_MAddF64r32 = 82136,   347     Iop_MAddF64r32 = 82136,
348     Iop_MSubF64r32 = 82137,   348     Iop_MSubF64r32 = 82137,
349     Iop_Est5FRSqrt = 82138,   349     Iop_Est5FRSqrt = 82138,
350     Iop_RoundF64toF64_NEAREST = 82139,   350     Iop_RoundF64toF64_NEAREST = 82139,
351     Iop_RoundF64toF64_NegINF = 82140,   351     Iop_RoundF64toF64_NegINF = 82140,
352     Iop_RoundF64toF64_PosINF = 82141,   352     Iop_RoundF64toF64_PosINF = 82141,
353     Iop_RoundF64toF64_ZERO = 82142,   353     Iop_RoundF64toF64_ZERO = 82142,
354     Iop_TruncF64asF32 = 82143,   354     Iop_TruncF64asF32 = 82143,
355     Iop_RoundF64toF32 = 82144,   355     Iop_RoundF64toF32 = 82144,
356     Iop_CalcFPRF = 82145,   356     Iop_CalcFPRF = 82145,
357     Iop_Add16x2 = 82146,   357     Iop_Add16x2 = 82146,
358     Iop_Sub16x2 = 82147,   358     Iop_Sub16x2 = 82147,
359     Iop_QAdd16Sx2 = 82148,   359     Iop_QAdd16Sx2 = 82148,
360     Iop_QAdd16Ux2 = 82149,   360     Iop_QAdd16Ux2 = 82149,
361     Iop_QSub16Sx2 = 82150,   361     Iop_QSub16Sx2 = 82150,
362     Iop_QSub16Ux2 = 82151,   362     Iop_QSub16Ux2 = 82151,
363     Iop_HAdd16Ux2 = 82152,   363     Iop_HAdd16Ux2 = 82152,
364     Iop_HAdd16Sx2 = 82153,   364     Iop_HAdd16Sx2 = 82153,
365     Iop_HSub16Ux2 = 82154,   365     Iop_HSub16Ux2 = 82154,
366     Iop_HSub16Sx2 = 82155,   366     Iop_HSub16Sx2 = 82155,
367     Iop_Add8x4 = 82156,   367     Iop_Add8x4 = 82156,
368     Iop_Sub8x4 = 82157,   368     Iop_Sub8x4 = 82157,
369     Iop_QAdd8Sx4 = 82158,   369     Iop_QAdd8Sx4 = 82158,
370     Iop_QAdd8Ux4 = 82159,   370     Iop_QAdd8Ux4 = 82159,
371     Iop_QSub8Sx4 = 82160,   371     Iop_QSub8Sx4 = 82160,
372     Iop_QSub8Ux4 = 82161,   372     Iop_QSub8Ux4 = 82161,
373     Iop_HAdd8Ux4 = 82162,   373     Iop_HAdd8Ux4 = 82162,
374     Iop_HAdd8Sx4 = 82163,   374     Iop_HAdd8Sx4 = 82163,
375     Iop_HSub8Ux4 = 82164,   375     Iop_HSub8Ux4 = 82164,
376     Iop_HSub8Sx4 = 82165,   376     Iop_HSub8Sx4 = 82165,
377     Iop_Sad8Ux4 = 82166,   377     Iop_Sad8Ux4 = 82166,
378     Iop_CmpNEZ16x2 = 82167,   378     Iop_CmpNEZ16x2 = 82167,
379     Iop_CmpNEZ8x4 = 82168,   379     Iop_CmpNEZ8x4 = 82168,
380     Iop_I32UtoFx2 = 82169,   380     Iop_I32UtoFx2 = 82169,
381     Iop_I32StoFx2 = 82170,   381     Iop_I32StoFx2 = 82170,
382     Iop_FtoI32Ux2_RZ = 82171,   382     Iop_FtoI32Ux2_RZ = 82171,
383     Iop_FtoI32Sx2_RZ = 82172,   383     Iop_FtoI32Sx2_RZ = 82172,
384     Iop_F32ToFixed32Ux2_RZ = 82173,   384     Iop_F32ToFixed32Ux2_RZ = 82173,
385     Iop_F32ToFixed32Sx2_RZ = 82174,   385     Iop_F32ToFixed32Sx2_RZ = 82174,
386     Iop_Fixed32UToF32x2_RN = 82175,   386     Iop_Fixed32UToF32x2_RN = 82175,
387     Iop_Fixed32SToF32x2_RN = 82176,   387     Iop_Fixed32SToF32x2_RN = 82176,
388     Iop_Max32Fx2 = 82177,   388     Iop_Max32Fx2 = 82177,
389     Iop_Min32Fx2 = 82178,   389     Iop_Min32Fx2 = 82178,
390     Iop_PwMax32Fx2 = 82179,   390     Iop_PwMax32Fx2 = 82179,
391     Iop_PwMin32Fx2 = 82180,   391     Iop_PwMin32Fx2 = 82180,
392     Iop_CmpEQ32Fx2 = 82181,   392     Iop_CmpEQ32Fx2 = 82181,
393     Iop_CmpGT32Fx2 = 82182,   393     Iop_CmpGT32Fx2 = 82182,
394     Iop_CmpGE32Fx2 = 82183,   394     Iop_CmpGE32Fx2 = 82183,
395     Iop_Recip32Fx2 = 82184,   395     Iop_Recip32Fx2 = 82184,
396     Iop_Recps32Fx2 = 82185,   396     Iop_Recps32Fx2 = 82185,
397     Iop_Rsqrte32Fx2 = 82186,   397     Iop_Rsqrte32Fx2 = 82186,
398     Iop_Rsqrts32Fx2 = 82187,   398     Iop_Rsqrts32Fx2 = 82187,
399     Iop_Neg32Fx2 = 82188,   399     Iop_Neg32Fx2 = 82188,
400     Iop_Abs32Fx2 = 82189,   400     Iop_Abs32Fx2 = 82189,
401     Iop_CmpNEZ8x8 = 82190,   401     Iop_CmpNEZ8x8 = 82190,
402     Iop_CmpNEZ16x4 = 82191,   402     Iop_CmpNEZ16x4 = 82191,
403     Iop_CmpNEZ32x2 = 82192,   403     Iop_CmpNEZ32x2 = 82192,
404     Iop_Add8x8 = 82193,   404     Iop_Add8x8 = 82193,
405     Iop_Add16x4 = 82194,   405     Iop_Add16x4 = 82194,
406     Iop_Add32x2 = 82195,   406     Iop_Add32x2 = 82195,
407     Iop_QAdd8Ux8 = 82196,   407     Iop_QAdd8Ux8 = 82196,
408     Iop_QAdd16Ux4 = 82197,   408     Iop_QAdd16Ux4 = 82197,
409     Iop_QAdd32Ux2 = 82198,   409     Iop_QAdd32Ux2 = 82198,
410     Iop_QAdd64Ux1 = 82199,   410     Iop_QAdd64Ux1 = 82199,
411     Iop_QAdd8Sx8 = 82200,   411     Iop_QAdd8Sx8 = 82200,
412     Iop_QAdd16Sx4 = 82201,   412     Iop_QAdd16Sx4 = 82201,
413     Iop_QAdd32Sx2 = 82202,   413     Iop_QAdd32Sx2 = 82202,
414     Iop_QAdd64Sx1 = 82203,   414     Iop_QAdd64Sx1 = 82203,
415     Iop_PwAdd8x8 = 82204,   415     Iop_PwAdd8x8 = 82204,
416     Iop_PwAdd16x4 = 82205,   416     Iop_PwAdd16x4 = 82205,
417     Iop_PwAdd32x2 = 82206,   417     Iop_PwAdd32x2 = 82206,
418     Iop_PwMax8Sx8 = 82207,   418     Iop_PwMax8Sx8 = 82207,
419     Iop_PwMax16Sx4 = 82208,   419     Iop_PwMax16Sx4 = 82208,
420     Iop_PwMax32Sx2 = 82209,   420     Iop_PwMax32Sx2 = 82209,
421     Iop_PwMax8Ux8 = 82210,   421     Iop_PwMax8Ux8 = 82210,
422     Iop_PwMax16Ux4 = 82211,   422     Iop_PwMax16Ux4 = 82211,
423     Iop_PwMax32Ux2 = 82212,   423     Iop_PwMax32Ux2 = 82212,
424     Iop_PwMin8Sx8 = 82213,   424     Iop_PwMin8Sx8 = 82213,
425     Iop_PwMin16Sx4 = 82214,   425     Iop_PwMin16Sx4 = 82214,
426     Iop_PwMin32Sx2 = 82215,   426     Iop_PwMin32Sx2 = 82215,
427     Iop_PwMin8Ux8 = 82216,   427     Iop_PwMin8Ux8 = 82216,
428     Iop_PwMin16Ux4 = 82217,   428     Iop_PwMin16Ux4 = 82217,
429     Iop_PwMin32Ux2 = 82218,   429     Iop_PwMin32Ux2 = 82218,
430     Iop_PwAddL8Ux8 = 82219,   430     Iop_PwAddL8Ux8 = 82219,
431     Iop_PwAddL16Ux4 = 82220,   431     Iop_PwAddL16Ux4 = 82220,
432     Iop_PwAddL32Ux2 = 82221,   432     Iop_PwAddL32Ux2 = 82221,
433     Iop_PwAddL8Sx8 = 82222,   433     Iop_PwAddL8Sx8 = 82222,
434     Iop_PwAddL16Sx4 = 82223,   434     Iop_PwAddL16Sx4 = 82223,
435     Iop_PwAddL32Sx2 = 82224,   435     Iop_PwAddL32Sx2 = 82224,
436     Iop_Sub8x8 = 82225,   436     Iop_Sub8x8 = 82225,
437     Iop_Sub16x4 = 82226,   437     Iop_Sub16x4 = 82226,
438     Iop_Sub32x2 = 82227,   438     Iop_Sub32x2 = 82227,
439     Iop_QSub8Ux8 = 82228,   439     Iop_QSub8Ux8 = 82228,
440     Iop_QSub16Ux4 = 82229,   440     Iop_QSub16Ux4 = 82229,
441     Iop_QSub32Ux2 = 82230,   441     Iop_QSub32Ux2 = 82230,
442     Iop_QSub64Ux1 = 82231,   442     Iop_QSub64Ux1 = 82231,
443     Iop_QSub8Sx8 = 82232,   443     Iop_QSub8Sx8 = 82232,
444     Iop_QSub16Sx4 = 82233,   444     Iop_QSub16Sx4 = 82233,
445     Iop_QSub32Sx2 = 82234,   445     Iop_QSub32Sx2 = 82234,
446     Iop_QSub64Sx1 = 82235,   446     Iop_QSub64Sx1 = 82235,
447     Iop_Abs8x8 = 82236,   447     Iop_Abs8x8 = 82236,
448     Iop_Abs16x4 = 82237,   448     Iop_Abs16x4 = 82237,
449     Iop_Abs32x2 = 82238,   449     Iop_Abs32x2 = 82238,
450     Iop_Mul8x8 = 82239,   450     Iop_Mul8x8 = 82239,
451     Iop_Mul16x4 = 82240,   451     Iop_Mul16x4 = 82240,
452     Iop_Mul32x2 = 82241,   452     Iop_Mul32x2 = 82241,
453     Iop_Mul32Fx2 = 82242,   453     Iop_Mul32Fx2 = 82242,
454     Iop_MulHi16Ux4 = 82243,   454     Iop_MulHi16Ux4 = 82243,
455     Iop_MulHi16Sx4 = 82244,   455     Iop_MulHi16Sx4 = 82244,
456     Iop_PolynomialMul8x8 = 82245,   456     Iop_PolynomialMul8x8 = 82245,
457     Iop_QDMulHi16Sx4 = 82246,   457     Iop_QDMulHi16Sx4 = 82246,
458     Iop_QDMulHi32Sx2 = 82247,   458     Iop_QDMulHi32Sx2 = 82247,
459     Iop_QRDMulHi16Sx4 = 82248,   459     Iop_QRDMulHi16Sx4 = 82248,
460     Iop_QRDMulHi32Sx2 = 82249,   460     Iop_QRDMulHi32Sx2 = 82249,
461     Iop_Avg8Ux8 = 82250,   461     Iop_Avg8Ux8 = 82250,
462     Iop_Avg16Ux4 = 82251,   462     Iop_Avg16Ux4 = 82251,
463     Iop_Max8Sx8 = 82252,   463     Iop_Max8Sx8 = 82252,
464     Iop_Max16Sx4 = 82253,   464     Iop_Max16Sx4 = 82253,
465     Iop_Max32Sx2 = 82254,   465     Iop_Max32Sx2 = 82254,
466     Iop_Max8Ux8 = 82255,   466     Iop_Max8Ux8 = 82255,
467     Iop_Max16Ux4 = 82256,   467     Iop_Max16Ux4 = 82256,
468     Iop_Max32Ux2 = 82257,   468     Iop_Max32Ux2 = 82257,
469     Iop_Min8Sx8 = 82258,   469     Iop_Min8Sx8 = 82258,
470     Iop_Min16Sx4 = 82259,   470     Iop_Min16Sx4 = 82259,
471     Iop_Min32Sx2 = 82260,   471     Iop_Min32Sx2 = 82260,
472     Iop_Min8Ux8 = 82261,   472     Iop_Min8Ux8 = 82261,
473     Iop_Min16Ux4 = 82262,   473     Iop_Min16Ux4 = 82262,
474     Iop_Min32Ux2 = 82263,   474     Iop_Min32Ux2 = 82263,
475     Iop_CmpEQ8x8 = 82264,   475     Iop_CmpEQ8x8 = 82264,
476     Iop_CmpEQ16x4 = 82265,   476     Iop_CmpEQ16x4 = 82265,
477     Iop_CmpEQ32x2 = 82266,   477     Iop_CmpEQ32x2 = 82266,
478     Iop_CmpGT8Ux8 = 82267,   478     Iop_CmpGT8Ux8 = 82267,
479     Iop_CmpGT16Ux4 = 82268,   479     Iop_CmpGT16Ux4 = 82268,
480     Iop_CmpGT32Ux2 = 82269,   480     Iop_CmpGT32Ux2 = 82269,
481     Iop_CmpGT8Sx8 = 82270,   481     Iop_CmpGT8Sx8 = 82270,
482     Iop_CmpGT16Sx4 = 82271,   482     Iop_CmpGT16Sx4 = 82271,
483     Iop_CmpGT32Sx2 = 82272,   483     Iop_CmpGT32Sx2 = 82272,
484     Iop_Cnt8x8 = 82273,   484     Iop_Cnt8x8 = 82273,
485     Iop_Clz8Sx8 = 82274,   485     Iop_Clz8Sx8 = 82274,
486     Iop_Clz16Sx4 = 82275,   486     Iop_Clz16Sx4 = 82275,
487     Iop_Clz32Sx2 = 82276,   487     Iop_Clz32Sx2 = 82276,
488     Iop_Cls8Sx8 = 82277,   488     Iop_Cls8Sx8 = 82277,
489     Iop_Cls16Sx4 = 82278,   489     Iop_Cls16Sx4 = 82278,
490     Iop_Cls32Sx2 = 82279,   490     Iop_Cls32Sx2 = 82279,
491     Iop_Shl8x8 = 82280,   491     Iop_Shl8x8 = 82280,
492     Iop_Shl16x4 = 82281,   492     Iop_Shl16x4 = 82281,
493     Iop_Shl32x2 = 82282,   493     Iop_Shl32x2 = 82282,
494     Iop_Shr8x8 = 82283,   494     Iop_Shr8x8 = 82283,
495     Iop_Shr16x4 = 82284,   495     Iop_Shr16x4 = 82284,
496     Iop_Shr32x2 = 82285,   496     Iop_Shr32x2 = 82285,
497     Iop_Sar8x8 = 82286,   497     Iop_Sar8x8 = 82286,
498     Iop_Sar16x4 = 82287,   498     Iop_Sar16x4 = 82287,
499     Iop_Sar32x2 = 82288,   499     Iop_Sar32x2 = 82288,
500     Iop_Sal8x8 = 82289,   500     Iop_Sal8x8 = 82289,
501     Iop_Sal16x4 = 82290,   501     Iop_Sal16x4 = 82290,
502     Iop_Sal32x2 = 82291,   502     Iop_Sal32x2 = 82291,
503     Iop_Sal64x1 = 82292,   503     Iop_Sal64x1 = 82292,
504     Iop_ShlN8x8 = 82293,   504     Iop_ShlN8x8 = 82293,
505     Iop_ShlN16x4 = 82294,   505     Iop_ShlN16x4 = 82294,
506     Iop_ShlN32x2 = 82295,   506     Iop_ShlN32x2 = 82295,
507     Iop_ShrN8x8 = 82296,   507     Iop_ShrN8x8 = 82296,
508     Iop_ShrN16x4 = 82297,   508     Iop_ShrN16x4 = 82297,
509     Iop_ShrN32x2 = 82298,   509     Iop_ShrN32x2 = 82298,
510     Iop_SarN8x8 = 82299,   510     Iop_SarN8x8 = 82299,
511     Iop_SarN16x4 = 82300,   511     Iop_SarN16x4 = 82300,
512     Iop_SarN32x2 = 82301,   512     Iop_SarN32x2 = 82301,
513     Iop_QShl8x8 = 82302,   513     Iop_QShl8x8 = 82302,
514     Iop_QShl16x4 = 82303,   514     Iop_QShl16x4 = 82303,
515     Iop_QShl32x2 = 82304,   515     Iop_QShl32x2 = 82304,
516     Iop_QShl64x1 = 82305,   516     Iop_QShl64x1 = 82305,
517     Iop_QSal8x8 = 82306,   517     Iop_QSal8x8 = 82306,
518     Iop_QSal16x4 = 82307,   518     Iop_QSal16x4 = 82307,
519     Iop_QSal32x2 = 82308,   519     Iop_QSal32x2 = 82308,
520     Iop_QSal64x1 = 82309,   520     Iop_QSal64x1 = 82309,
521     Iop_QShlN8Sx8 = 82310,   521     Iop_QShlN8Sx8 = 82310,
522     Iop_QShlN16Sx4 = 82311,   522     Iop_QShlN16Sx4 = 82311,
523     Iop_QShlN32Sx2 = 82312,   523     Iop_QShlN32Sx2 = 82312,
524     Iop_QShlN64Sx1 = 82313,   524     Iop_QShlN64Sx1 = 82313,
525     Iop_QShlN8x8 = 82314,   525     Iop_QShlN8x8 = 82314,
526     Iop_QShlN16x4 = 82315,   526     Iop_QShlN16x4 = 82315,
527     Iop_QShlN32x2 = 82316,   527     Iop_QShlN32x2 = 82316,
528     Iop_QShlN64x1 = 82317,   528     Iop_QShlN64x1 = 82317,
529     Iop_QSalN8x8 = 82318,   529     Iop_QSalN8x8 = 82318,
530     Iop_QSalN16x4 = 82319,   530     Iop_QSalN16x4 = 82319,
531     Iop_QSalN32x2 = 82320,   531     Iop_QSalN32x2 = 82320,
532     Iop_QSalN64x1 = 82321,   532     Iop_QSalN64x1 = 82321,
533     Iop_QNarrow16Ux4 = 82322,   533     Iop_QNarrow16Ux4 = 82322,
534     Iop_QNarrow16Sx4 = 82323,   534     Iop_QNarrow16Sx4 = 82323,
535     Iop_QNarrow32Sx2 = 82324,   535     Iop_QNarrow32Sx2 = 82324,
536     Iop_InterleaveHI8x8 = 82325,   536     Iop_InterleaveHI8x8 = 82325,
537     Iop_InterleaveHI16x4 = 82326,   537     Iop_InterleaveHI16x4 = 82326,
538     Iop_InterleaveHI32x2 = 82327,   538     Iop_InterleaveHI32x2 = 82327,
539     Iop_InterleaveLO8x8 = 82328,   539     Iop_InterleaveLO8x8 = 82328,
540     Iop_InterleaveLO16x4 = 82329,   540     Iop_InterleaveLO16x4 = 82329,
541     Iop_InterleaveLO32x2 = 82330,   541     Iop_InterleaveLO32x2 = 82330,
542     Iop_InterleaveOddLanes8x8 = 82331,   542     Iop_InterleaveOddLanes8x8 = 82331,
543     Iop_InterleaveEvenLanes8x8 = 82332,   543     Iop_InterleaveEvenLanes8x8 = 82332,
544     Iop_InterleaveOddLanes16x4 = 82333,   544     Iop_InterleaveOddLanes16x4 = 82333,
545     Iop_InterleaveEvenLanes16x4 = 82334,   545     Iop_InterleaveEvenLanes16x4 = 82334,
546     Iop_CatOddLanes8x8 = 82335,   546     Iop_CatOddLanes8x8 = 82335,
547     Iop_CatOddLanes16x4 = 82336,   547     Iop_CatOddLanes16x4 = 82336,
548     Iop_CatEvenLanes8x8 = 82337,   548     Iop_CatEvenLanes8x8 = 82337,
549     Iop_CatEvenLanes16x4 = 82338,   549     Iop_CatEvenLanes16x4 = 82338,
550     Iop_GetElem8x8 = 82339,   550     Iop_GetElem8x8 = 82339,
551     Iop_GetElem16x4 = 82340,   551     Iop_GetElem16x4 = 82340,
552     Iop_GetElem32x2 = 82341,   552     Iop_GetElem32x2 = 82341,
553     Iop_SetElem8x8 = 82342,   553     Iop_SetElem8x8 = 82342,
554     Iop_SetElem16x4 = 82343,   554     Iop_SetElem16x4 = 82343,
555     Iop_SetElem32x2 = 82344,   555     Iop_SetElem32x2 = 82344,
556     Iop_Dup8x8 = 82345,   556     Iop_Dup8x8 = 82345,
557     Iop_Dup16x4 = 82346,   557     Iop_Dup16x4 = 82346,
558     Iop_Dup32x2 = 82347,   558     Iop_Dup32x2 = 82347,
559     Iop_Extract64 = 82348,   559     Iop_Extract64 = 82348,
560     Iop_Reverse16_8x8 = 82349,   560     Iop_Reverse16_8x8 = 82349,
561     Iop_Reverse32_8x8 = 82350,   561     Iop_Reverse32_8x8 = 82350,
562     Iop_Reverse32_16x4 = 82351,   562     Iop_Reverse32_16x4 = 82351,
563     Iop_Reverse64_8x8 = 82352,   563     Iop_Reverse64_8x8 = 82352,
564     Iop_Reverse64_16x4 = 82353,   564     Iop_Reverse64_16x4 = 82353,
565     Iop_Reverse64_32x2 = 82354,   565     Iop_Reverse64_32x2 = 82354,
566     Iop_Perm8x8 = 82355,   566     Iop_Perm8x8 = 82355,
567     Iop_Recip32x2 = 82356,   567     Iop_Recip32x2 = 82356,
568     Iop_Rsqrte32x2 = 82357,   568     Iop_Rsqrte32x2 = 82357,
569     Iop_Add32Fx4 = 82358,   569     Iop_Add32Fx4 = 82358,
570     Iop_Sub32Fx4 = 82359,   570     Iop_Sub32Fx4 = 82359,
571     Iop_Mul32Fx4 = 82360,   571     Iop_Mul32Fx4 = 82360,
572     Iop_Div32Fx4 = 82361,   572     Iop_Div32Fx4 = 82361,
573     Iop_Max32Fx4 = 82362,   573     Iop_Max32Fx4 = 82362,
574     Iop_Min32Fx4 = 82363,   574     Iop_Min32Fx4 = 82363,
575     Iop_Add32Fx2 = 82364,   575     Iop_Add32Fx2 = 82364,
576     Iop_Sub32Fx2 = 82365,   576     Iop_Sub32Fx2 = 82365,
577     Iop_CmpEQ32Fx4 = 82366,   577     Iop_CmpEQ32Fx4 = 82366,
578     Iop_CmpLT32Fx4 = 82367,   578     Iop_CmpLT32Fx4 = 82367,
579     Iop_CmpLE32Fx4 = 82368,   579     Iop_CmpLE32Fx4 = 82368,
580     Iop_CmpUN32Fx4 = 82369,   580     Iop_CmpUN32Fx4 = 82369,
581     Iop_CmpGT32Fx4 = 82370,   581     Iop_CmpGT32Fx4 = 82370,
582     Iop_CmpGE32Fx4 = 82371,   582     Iop_CmpGE32Fx4 = 82371,
583     Iop_Abs32Fx4 = 82372,   583     Iop_Abs32Fx4 = 82372,
584     Iop_PwMax32Fx4 = 82373,   584     Iop_PwMax32Fx4 = 82373,
585     Iop_PwMin32Fx4 = 82374,   585     Iop_PwMin32Fx4 = 82374,
586     Iop_Sqrt32Fx4 = 82375,   586     Iop_Sqrt32Fx4 = 82375,
587     Iop_RSqrt32Fx4 = 82376,   587     Iop_RSqrt32Fx4 = 82376,
588     Iop_Neg32Fx4 = 82377,   588     Iop_Neg32Fx4 = 82377,
589     Iop_Recip32Fx4 = 82378,   589     Iop_Recip32Fx4 = 82378,
590     Iop_Recps32Fx4 = 82379,   590     Iop_Recps32Fx4 = 82379,
591     Iop_Rsqrte32Fx4 = 82380,   591     Iop_Rsqrte32Fx4 = 82380,
592     Iop_Rsqrts32Fx4 = 82381,   592     Iop_Rsqrts32Fx4 = 82381,
593     Iop_I32UtoFx4 = 82382,   593     Iop_I32UtoFx4 = 82382,
594     Iop_I32StoFx4 = 82383,   594     Iop_I32StoFx4 = 82383,
595     Iop_FtoI32Ux4_RZ = 82384,   595     Iop_FtoI32Ux4_RZ = 82384,
596     Iop_FtoI32Sx4_RZ = 82385,   596     Iop_FtoI32Sx4_RZ = 82385,
597     Iop_QFtoI32Ux4_RZ = 82386,   597     Iop_QFtoI32Ux4_RZ = 82386,
598     Iop_QFtoI32Sx4_RZ = 82387,   598     Iop_QFtoI32Sx4_RZ = 82387,
599     Iop_RoundF32x4_RM = 82388,   599     Iop_RoundF32x4_RM = 82388,
600     Iop_RoundF32x4_RP = 82389,   600     Iop_RoundF32x4_RP = 82389,
601     Iop_RoundF32x4_RN = 82390,   601     Iop_RoundF32x4_RN = 82390,
602     Iop_RoundF32x4_RZ = 82391,   602     Iop_RoundF32x4_RZ = 82391,
603     Iop_F32ToFixed32Ux4_RZ = 82392,   603     Iop_F32ToFixed32Ux4_RZ = 82392,
604     Iop_F32ToFixed32Sx4_RZ = 82393,   604     Iop_F32ToFixed32Sx4_RZ = 82393,
605     Iop_Fixed32UToF32x4_RN = 82394,   605     Iop_Fixed32UToF32x4_RN = 82394,
606     Iop_Fixed32SToF32x4_RN = 82395,   606     Iop_Fixed32SToF32x4_RN = 82395,
607     Iop_F32toF16x4 = 82396,   607     Iop_F32toF16x4 = 82396,
608     Iop_F16toF32x4 = 82397,   608     Iop_F16toF32x4 = 82397,
609     Iop_Add32F0x4 = 82398,   609     Iop_Add32F0x4 = 82398,
610     Iop_Sub32F0x4 = 82399,   610     Iop_Sub32F0x4 = 82399,
611     Iop_Mul32F0x4 = 82400,   611     Iop_Mul32F0x4 = 82400,
612     Iop_Div32F0x4 = 82401,   612     Iop_Div32F0x4 = 82401,
613     Iop_Max32F0x4 = 82402,   613     Iop_Max32F0x4 = 82402,
614     Iop_Min32F0x4 = 82403,   614     Iop_Min32F0x4 = 82403,
615     Iop_CmpEQ32F0x4 = 82404,   615     Iop_CmpEQ32F0x4 = 82404,
616     Iop_CmpLT32F0x4 = 82405,   616     Iop_CmpLT32F0x4 = 82405,
617     Iop_CmpLE32F0x4 = 82406,   617     Iop_CmpLE32F0x4 = 82406,
618     Iop_CmpUN32F0x4 = 82407,   618     Iop_CmpUN32F0x4 = 82407,
619     Iop_Recip32F0x4 = 82408,   619     Iop_Recip32F0x4 = 82408,
620     Iop_Sqrt32F0x4 = 82409,   620     Iop_Sqrt32F0x4 = 82409,
621     Iop_RSqrt32F0x4 = 82410,   621     Iop_RSqrt32F0x4 = 82410,
622     Iop_Add64Fx2 = 82411,   622     Iop_Add64Fx2 = 82411,
623     Iop_Sub64Fx2 = 82412,   623     Iop_Sub64Fx2 = 82412,
624     Iop_Mul64Fx2 = 82413,   624     Iop_Mul64Fx2 = 82413,
625     Iop_Div64Fx2 = 82414,   625     Iop_Div64Fx2 = 82414,
626     Iop_Max64Fx2 = 82415,   626     Iop_Max64Fx2 = 82415,
627     Iop_Min64Fx2 = 82416,   627     Iop_Min64Fx2 = 82416,
628     Iop_CmpEQ64Fx2 = 82417,   628     Iop_CmpEQ64Fx2 = 82417,
629     Iop_CmpLT64Fx2 = 82418,   629     Iop_CmpLT64Fx2 = 82418,
630     Iop_CmpLE64Fx2 = 82419,   630     Iop_CmpLE64Fx2 = 82419,
631     Iop_CmpUN64Fx2 = 82420,   631     Iop_CmpUN64Fx2 = 82420,
632     Iop_Recip64Fx2 = 82421,   632     Iop_Recip64Fx2 = 82421,
633     Iop_Sqrt64Fx2 = 82422,   633     Iop_Sqrt64Fx2 = 82422,
634     Iop_RSqrt64Fx2 = 82423,   634     Iop_RSqrt64Fx2 = 82423,
635     Iop_Add64F0x2 = 82424,   635     Iop_Add64F0x2 = 82424,
636     Iop_Sub64F0x2 = 82425,   636     Iop_Sub64F0x2 = 82425,
637     Iop_Mul64F0x2 = 82426,   637     Iop_Mul64F0x2 = 82426,
638     Iop_Div64F0x2 = 82427,   638     Iop_Div64F0x2 = 82427,
639     Iop_Max64F0x2 = 82428,   639     Iop_Max64F0x2 = 82428,
640     Iop_Min64F0x2 = 82429,   640     Iop_Min64F0x2 = 82429,
641     Iop_CmpEQ64F0x2 = 82430,   641     Iop_CmpEQ64F0x2 = 82430,
642     Iop_CmpLT64F0x2 = 82431,   642     Iop_CmpLT64F0x2 = 82431,
643     Iop_CmpLE64F0x2 = 82432,   643     Iop_CmpLE64F0x2 = 82432,
644     Iop_CmpUN64F0x2 = 82433,   644     Iop_CmpUN64F0x2 = 82433,
645     Iop_Recip64F0x2 = 82434,   645     Iop_Recip64F0x2 = 82434,
646     Iop_Sqrt64F0x2 = 82435,   646     Iop_Sqrt64F0x2 = 82435,
647     Iop_RSqrt64F0x2 = 82436,   647     Iop_RSqrt64F0x2 = 82436,
648     Iop_V128to64 = 82437,   648     Iop_V128to64 = 82437,
649     Iop_V128HIto64 = 82438,   649     Iop_V128HIto64 = 82438,
650     Iop_64HLtoV128 = 82439,   650     Iop_64HLtoV128 = 82439,
651     Iop_64UtoV128 = 82440,   651     Iop_64UtoV128 = 82440,
652     Iop_SetV128lo64 = 82441,   652     Iop_SetV128lo64 = 82441,
653     Iop_32UtoV128 = 82442,   653     Iop_32UtoV128 = 82442,
654     Iop_V128to32 = 82443,   654     Iop_V128to32 = 82443,
655     Iop_SetV128lo32 = 82444,   655     Iop_SetV128lo32 = 82444,
656     Iop_NotV128 = 82445,   656     Iop_NotV128 = 82445,
657     Iop_AndV128 = 82446,   657     Iop_AndV128 = 82446,
658     Iop_OrV128 = 82447,   658     Iop_OrV128 = 82447,
659     Iop_XorV128 = 82448,   659     Iop_XorV128 = 82448,
660     Iop_ShlV128 = 82449,   660     Iop_ShlV128 = 82449,
661     Iop_ShrV128 = 82450,   661     Iop_ShrV128 = 82450,
662     Iop_CmpNEZ8x16 = 82451,   662     Iop_CmpNEZ8x16 = 82451,
663     Iop_CmpNEZ16x8 = 82452,   663     Iop_CmpNEZ16x8 = 82452,
664     Iop_CmpNEZ32x4 = 82453,   664     Iop_CmpNEZ32x4 = 82453,
665     Iop_CmpNEZ64x2 = 82454,   665     Iop_CmpNEZ64x2 = 82454,
666     Iop_Add8x16 = 82455,   666     Iop_Add8x16 = 82455,
667     Iop_Add16x8 = 82456,   667     Iop_Add16x8 = 82456,
668     Iop_Add32x4 = 82457,   668     Iop_Add32x4 = 82457,
669     Iop_Add64x2 = 82458,   669     Iop_Add64x2 = 82458,
670     Iop_QAdd8Ux16 = 82459,   670     Iop_QAdd8Ux16 = 82459,
671     Iop_QAdd16Ux8 = 82460,   671     Iop_QAdd16Ux8 = 82460,
672     Iop_QAdd32Ux4 = 82461,   672     Iop_QAdd32Ux4 = 82461,
673     Iop_QAdd64Ux2 = 82462,   673     Iop_QAdd64Ux2 = 82462,
674     Iop_QAdd8Sx16 = 82463,   674     Iop_QAdd8Sx16 = 82463,
675     Iop_QAdd16Sx8 = 82464,   675     Iop_QAdd16Sx8 = 82464,
676     Iop_QAdd32Sx4 = 82465,   676     Iop_QAdd32Sx4 = 82465,
677     Iop_QAdd64Sx2 = 82466,   677     Iop_QAdd64Sx2 = 82466,
678     Iop_Sub8x16 = 82467,   678     Iop_Sub8x16 = 82467,
679     Iop_Sub16x8 = 82468,   679     Iop_Sub16x8 = 82468,
680     Iop_Sub32x4 = 82469,   680     Iop_Sub32x4 = 82469,
681     Iop_Sub64x2 = 82470,   681     Iop_Sub64x2 = 82470,
682     Iop_QSub8Ux16 = 82471,   682     Iop_QSub8Ux16 = 82471,
683     Iop_QSub16Ux8 = 82472,   683     Iop_QSub16Ux8 = 82472,
684     Iop_QSub32Ux4 = 82473,   684     Iop_QSub32Ux4 = 82473,
685     Iop_QSub64Ux2 = 82474,   685     Iop_QSub64Ux2 = 82474,
686     Iop_QSub8Sx16 = 82475,   686     Iop_QSub8Sx16 = 82475,
687     Iop_QSub16Sx8 = 82476,   687     Iop_QSub16Sx8 = 82476,
688     Iop_QSub32Sx4 = 82477,   688     Iop_QSub32Sx4 = 82477,
689     Iop_QSub64Sx2 = 82478,   689     Iop_QSub64Sx2 = 82478,
690     Iop_Mul8x16 = 82479,   690     Iop_Mul8x16 = 82479,
691     Iop_Mul16x8 = 82480,   691     Iop_Mul16x8 = 82480,
692     Iop_Mul32x4 = 82481,   692     Iop_Mul32x4 = 82481,
693     Iop_MulHi16Ux8 = 82482,   693     Iop_MulHi16Ux8 = 82482,
694     Iop_MulHi32Ux4 = 82483,   694     Iop_MulHi32Ux4 = 82483,
695     Iop_MulHi16Sx8 = 82484,   695     Iop_MulHi16Sx8 = 82484,
696     Iop_MulHi32Sx4 = 82485,   696     Iop_MulHi32Sx4 = 82485,
697     Iop_MullEven8Ux16 = 82486,   697     Iop_MullEven8Ux16 = 82486,
698     Iop_MullEven16Ux8 = 82487,   698     Iop_MullEven16Ux8 = 82487,
699     Iop_MullEven8Sx16 = 82488,   699     Iop_MullEven8Sx16 = 82488,
700     Iop_MullEven16Sx8 = 82489,   700     Iop_MullEven16Sx8 = 82489,
701     Iop_Mull8Ux8 = 82490,   701     Iop_Mull8Ux8 = 82490,
702     Iop_Mull8Sx8 = 82491,   702     Iop_Mull8Sx8 = 82491,
703     Iop_Mull16Ux4 = 82492,   703     Iop_Mull16Ux4 = 82492,
704     Iop_Mull16Sx4 = 82493,   704     Iop_Mull16Sx4 = 82493,
705     Iop_Mull32Ux2 = 82494,   705     Iop_Mull32Ux2 = 82494,
706     Iop_Mull32Sx2 = 82495,   706     Iop_Mull32Sx2 = 82495,
707     Iop_QDMulHi16Sx8 = 82496,   707     Iop_QDMulHi16Sx8 = 82496,
708     Iop_QDMulHi32Sx4 = 82497,   708     Iop_QDMulHi32Sx4 = 82497,
709     Iop_QRDMulHi16Sx8 = 82498,   709     Iop_QRDMulHi16Sx8 = 82498,
710     Iop_QRDMulHi32Sx4 = 82499,   710     Iop_QRDMulHi32Sx4 = 82499,
711     Iop_QDMulLong16Sx4 = 82500,   711     Iop_QDMulLong16Sx4 = 82500,
712     Iop_QDMulLong32Sx2 = 82501,   712     Iop_QDMulLong32Sx2 = 82501,
713     Iop_PolynomialMul8x16 = 82502,   713     Iop_PolynomialMul8x16 = 82502,
714     Iop_PolynomialMull8x8 = 82503,   714     Iop_PolynomialMull8x8 = 82503,
715     Iop_PwAdd8x16 = 82504,   715     Iop_PwAdd8x16 = 82504,
716     Iop_PwAdd16x8 = 82505,   716     Iop_PwAdd16x8 = 82505,
717     Iop_PwAdd32x4 = 82506,   717     Iop_PwAdd32x4 = 82506,
718     Iop_PwAdd32Fx2 = 82507,   718     Iop_PwAdd32Fx2 = 82507,
719     Iop_PwAddL8Ux16 = 82508,   719     Iop_PwAddL8Ux16 = 82508,
720     Iop_PwAddL16Ux8 = 82509,   720     Iop_PwAddL16Ux8 = 82509,
721     Iop_PwAddL32Ux4 = 82510,   721     Iop_PwAddL32Ux4 = 82510,
722     Iop_PwAddL8Sx16 = 82511,   722     Iop_PwAddL8Sx16 = 82511,
723     Iop_PwAddL16Sx8 = 82512,   723     Iop_PwAddL16Sx8 = 82512,
724     Iop_PwAddL32Sx4 = 82513,   724     Iop_PwAddL32Sx4 = 82513,
725     Iop_Abs8x16 = 82514,   725     Iop_Abs8x16 = 82514,
726     Iop_Abs16x8 = 82515,   726     Iop_Abs16x8 = 82515,
727     Iop_Abs32x4 = 82516,   727     Iop_Abs32x4 = 82516,
728     Iop_Avg8Ux16 = 82517,   728     Iop_Avg8Ux16 = 82517,
729     Iop_Avg16Ux8 = 82518,   729     Iop_Avg16Ux8 = 82518,
730     Iop_Avg32Ux4 = 82519,   730     Iop_Avg32Ux4 = 82519,
731     Iop_Avg8Sx16 = 82520,   731     Iop_Avg8Sx16 = 82520,
732     Iop_Avg16Sx8 = 82521,   732     Iop_Avg16Sx8 = 82521,
733     Iop_Avg32Sx4 = 82522,   733     Iop_Avg32Sx4 = 82522,
734     Iop_Max8Sx16 = 82523,   734     Iop_Max8Sx16 = 82523,
735     Iop_Max16Sx8 = 82524,   735     Iop_Max16Sx8 = 82524,
736     Iop_Max32Sx4 = 82525,   736     Iop_Max32Sx4 = 82525,
737     Iop_Max8Ux16 = 82526,   737     Iop_Max8Ux16 = 82526,
738     Iop_Max16Ux8 = 82527,   738     Iop_Max16Ux8 = 82527,
739     Iop_Max32Ux4 = 82528,   739     Iop_Max32Ux4 = 82528,
740     Iop_Min8Sx16 = 82529,   740     Iop_Min8Sx16 = 82529,
741     Iop_Min16Sx8 = 82530,   741     Iop_Min16Sx8 = 82530,
742     Iop_Min32Sx4 = 82531,   742     Iop_Min32Sx4 = 82531,
743     Iop_Min8Ux16 = 82532,   743     Iop_Min8Ux16 = 82532,
744     Iop_Min16Ux8 = 82533,   744     Iop_Min16Ux8 = 82533,
745     Iop_Min32Ux4 = 82534,   745     Iop_Min32Ux4 = 82534,
746     Iop_CmpEQ8x16 = 82535,   746     Iop_CmpEQ8x16 = 82535,
747     Iop_CmpEQ16x8 = 82536,   747     Iop_CmpEQ16x8 = 82536,
748     Iop_CmpEQ32x4 = 82537,   748     Iop_CmpEQ32x4 = 82537,
749     Iop_CmpGT8Sx16 = 82538,   749     Iop_CmpGT8Sx16 = 82538,
750     Iop_CmpGT16Sx8 = 82539,   750     Iop_CmpGT16Sx8 = 82539,
751     Iop_CmpGT32Sx4 = 82540,   751     Iop_CmpGT32Sx4 = 82540,
752     Iop_CmpGT64Sx2 = 82541,   752     Iop_CmpGT64Sx2 = 82541,
753     Iop_CmpGT8Ux16 = 82542,   753     Iop_CmpGT8Ux16 = 82542,
754     Iop_CmpGT16Ux8 = 82543,   754     Iop_CmpGT16Ux8 = 82543,
755     Iop_CmpGT32Ux4 = 82544,   755     Iop_CmpGT32Ux4 = 82544,
756     Iop_Cnt8x16 = 82545,   756     Iop_Cnt8x16 = 82545,
757     Iop_Clz8Sx16 = 82546,   757     Iop_Clz8Sx16 = 82546,
758     Iop_Clz16Sx8 = 82547,   758     Iop_Clz16Sx8 = 82547,
759     Iop_Clz32Sx4 = 82548,   759     Iop_Clz32Sx4 = 82548,
760     Iop_Cls8Sx16 = 82549,   760     Iop_Cls8Sx16 = 82549,
761     Iop_Cls16Sx8 = 82550,   761     Iop_Cls16Sx8 = 82550,
762     Iop_Cls32Sx4 = 82551,   762     Iop_Cls32Sx4 = 82551,
763     Iop_ShlN8x16 = 82552,   763     Iop_ShlN8x16 = 82552,
764     Iop_ShlN16x8 = 82553,   764     Iop_ShlN16x8 = 82553,
765     Iop_ShlN32x4 = 82554,   765     Iop_ShlN32x4 = 82554,
766     Iop_ShlN64x2 = 82555,   766     Iop_ShlN64x2 = 82555,
767     Iop_ShrN8x16 = 82556,   767     Iop_ShrN8x16 = 82556,
768     Iop_ShrN16x8 = 82557,   768     Iop_ShrN16x8 = 82557,
769     Iop_ShrN32x4 = 82558,   769     Iop_ShrN32x4 = 82558,
770     Iop_ShrN64x2 = 82559,   770     Iop_ShrN64x2 = 82559,
771     Iop_SarN8x16 = 82560,   771     Iop_SarN8x16 = 82560,
772     Iop_SarN16x8 = 82561,   772     Iop_SarN16x8 = 82561,
773     Iop_SarN32x4 = 82562,   773     Iop_SarN32x4 = 82562,
774     Iop_SarN64x2 = 82563,   774     Iop_SarN64x2 = 82563,
775     Iop_Shl8x16 = 82564,   775     Iop_Shl8x16 = 82564,
776     Iop_Shl16x8 = 82565,   776     Iop_Shl16x8 = 82565,
777     Iop_Shl32x4 = 82566,   777     Iop_Shl32x4 = 82566,
778     Iop_Shl64x2 = 82567,   778     Iop_Shl64x2 = 82567,
779     Iop_Shr8x16 = 82568,   779     Iop_Shr8x16 = 82568,
780     Iop_Shr16x8 = 82569,   780     Iop_Shr16x8 = 82569,
781     Iop_Shr32x4 = 82570,   781     Iop_Shr32x4 = 82570,
782     Iop_Shr64x2 = 82571,   782     Iop_Shr64x2 = 82571,
783     Iop_Sar8x16 = 82572,   783     Iop_Sar8x16 = 82572,
784     Iop_Sar16x8 = 82573,   784     Iop_Sar16x8 = 82573,
785     Iop_Sar32x4 = 82574,   785     Iop_Sar32x4 = 82574,
786     Iop_Sar64x2 = 82575,   786     Iop_Sar64x2 = 82575,
787     Iop_Sal8x16 = 82576,   787     Iop_Sal8x16 = 82576,
788     Iop_Sal16x8 = 82577,   788     Iop_Sal16x8 = 82577,
789     Iop_Sal32x4 = 82578,   789     Iop_Sal32x4 = 82578,
790     Iop_Sal64x2 = 82579,   790     Iop_Sal64x2 = 82579,
791     Iop_Rol8x16 = 82580,   791     Iop_Rol8x16 = 82580,
792     Iop_Rol16x8 = 82581,   792     Iop_Rol16x8 = 82581,
793     Iop_Rol32x4 = 82582,   793     Iop_Rol32x4 = 82582,
794     Iop_QShl8x16 = 82583,   794     Iop_QShl8x16 = 82583,
795     Iop_QShl16x8 = 82584,   795     Iop_QShl16x8 = 82584,
796     Iop_QShl32x4 = 82585,   796     Iop_QShl32x4 = 82585,
797     Iop_QShl64x2 = 82586,   797     Iop_QShl64x2 = 82586,
798     Iop_QSal8x16 = 82587,   798     Iop_QSal8x16 = 82587,
799     Iop_QSal16x8 = 82588,   799     Iop_QSal16x8 = 82588,
800     Iop_QSal32x4 = 82589,   800     Iop_QSal32x4 = 82589,
801     Iop_QSal64x2 = 82590,   801     Iop_QSal64x2 = 82590,
802     Iop_QShlN8Sx16 = 82591,   802     Iop_QShlN8Sx16 = 82591,
803     Iop_QShlN16Sx8 = 82592,   803     Iop_QShlN16Sx8 = 82592,
804     Iop_QShlN32Sx4 = 82593,   804     Iop_QShlN32Sx4 = 82593,
805     Iop_QShlN64Sx2 = 82594,   805     Iop_QShlN64Sx2 = 82594,
806     Iop_QShlN8x16 = 82595,   806     Iop_QShlN8x16 = 82595,
807     Iop_QShlN16x8 = 82596,   807     Iop_QShlN16x8 = 82596,
808     Iop_QShlN32x4 = 82597,   808     Iop_QShlN32x4 = 82597,
809     Iop_QShlN64x2 = 82598,   809     Iop_QShlN64x2 = 82598,
810     Iop_QSalN8x16 = 82599,   810     Iop_QSalN8x16 = 82599,
811     Iop_QSalN16x8 = 82600,   811     Iop_QSalN16x8 = 82600,
812     Iop_QSalN32x4 = 82601,   812     Iop_QSalN32x4 = 82601,
813     Iop_QSalN64x2 = 82602,   813     Iop_QSalN64x2 = 82602,
814     Iop_QNarrow16Ux8 = 82603,   814     Iop_QNarrow16Ux8 = 82603,
815     Iop_QNarrow32Ux4 = 82604,   815     Iop_QNarrow32Ux4 = 82604,
816     Iop_QNarrow16Sx8 = 82605,   816     Iop_QNarrow16Sx8 = 82605,
817     Iop_QNarrow32Sx4 = 82606,   817     Iop_QNarrow32Sx4 = 82606,
818     Iop_Narrow16x8 = 82607,   818     Iop_Narrow16x8 = 82607,
819     Iop_Narrow32x4 = 82608,   819     Iop_Narrow32x4 = 82608,
820     Iop_Shorten16x8 = 82609,   820     Iop_Shorten16x8 = 82609,
821     Iop_Shorten32x4 = 82610,   821     Iop_Shorten32x4 = 82610,
822     Iop_Shorten64x2 = 82611,   822     Iop_Shorten64x2 = 82611,
823     Iop_QShortenS16Sx8 = 82612,   823     Iop_QShortenS16Sx8 = 82612,
824     Iop_QShortenS32Sx4 = 82613,   824     Iop_QShortenS32Sx4 = 82613,
825     Iop_QShortenS64Sx2 = 82614,   825     Iop_QShortenS64Sx2 = 82614,
826     Iop_QShortenU16Sx8 = 82615,   826     Iop_QShortenU16Sx8 = 82615,
827     Iop_QShortenU32Sx4 = 82616,   827     Iop_QShortenU32Sx4 = 82616,
828     Iop_QShortenU64Sx2 = 82617,   828     Iop_QShortenU64Sx2 = 82617,
829     Iop_QShortenU16Ux8 = 82618,   829     Iop_QShortenU16Ux8 = 82618,
830     Iop_QShortenU32Ux4 = 82619,   830     Iop_QShortenU32Ux4 = 82619,
831     Iop_QShortenU64Ux2 = 82620,   831     Iop_QShortenU64Ux2 = 82620,
832     Iop_Longen8Ux8 = 82621,   832     Iop_Longen8Ux8 = 82621,
833     Iop_Longen16Ux4 = 82622,   833     Iop_Longen16Ux4 = 82622,
834     Iop_Longen32Ux2 = 82623,   834     Iop_Longen32Ux2 = 82623,
835     Iop_Longen8Sx8 = 82624,   835     Iop_Longen8Sx8 = 82624,
836     Iop_Longen16Sx4 = 82625,   836     Iop_Longen16Sx4 = 82625,
837     Iop_Longen32Sx2 = 82626,   837     Iop_Longen32Sx2 = 82626,
838     Iop_InterleaveHI8x16 = 82627,   838     Iop_InterleaveHI8x16 = 82627,
839     Iop_InterleaveHI16x8 = 82628,   839     Iop_InterleaveHI16x8 = 82628,
840     Iop_InterleaveHI32x4 = 82629,   840     Iop_InterleaveHI32x4 = 82629,
841     Iop_InterleaveHI64x2 = 82630,   841     Iop_InterleaveHI64x2 = 82630,
842     Iop_InterleaveLO8x16 = 82631,   842     Iop_InterleaveLO8x16 = 82631,
843     Iop_InterleaveLO16x8 = 82632,   843     Iop_InterleaveLO16x8 = 82632,
844     Iop_InterleaveLO32x4 = 82633,   844     Iop_InterleaveLO32x4 = 82633,
845     Iop_InterleaveLO64x2 = 82634,   845     Iop_InterleaveLO64x2 = 82634,
846     Iop_InterleaveOddLanes8x16 = 82635,   846     Iop_InterleaveOddLanes8x16 = 82635,
847     Iop_InterleaveEvenLanes8x16 = 82636,   847     Iop_InterleaveEvenLanes8x16 = 82636,
848     Iop_InterleaveOddLanes16x8 = 82637,   848     Iop_InterleaveOddLanes16x8 = 82637,
849     Iop_InterleaveEvenLanes16x8 = 82638,   849     Iop_InterleaveEvenLanes16x8 = 82638,
850     Iop_InterleaveOddLanes32x4 = 82639,   850     Iop_InterleaveOddLanes32x4 = 82639,
851     Iop_InterleaveEvenLanes32x4 = 82640,   851     Iop_InterleaveEvenLanes32x4 = 82640,
852     Iop_CatOddLanes8x16 = 82641,   852     Iop_CatOddLanes8x16 = 82641,
853     Iop_CatOddLanes16x8 = 82642,   853     Iop_CatOddLanes16x8 = 82642,
854     Iop_CatOddLanes32x4 = 82643,   854     Iop_CatOddLanes32x4 = 82643,
855     Iop_CatEvenLanes8x16 = 82644,   855     Iop_CatEvenLanes8x16 = 82644,
856     Iop_CatEvenLanes16x8 = 82645,   856     Iop_CatEvenLanes16x8 = 82645,
857     Iop_CatEvenLanes32x4 = 82646,   857     Iop_CatEvenLanes32x4 = 82646,
858     Iop_GetElem8x16 = 82647,   858     Iop_GetElem8x16 = 82647,
859     Iop_GetElem16x8 = 82648,   859     Iop_GetElem16x8 = 82648,
860     Iop_GetElem32x4 = 82649,   860     Iop_GetElem32x4 = 82649,
861     Iop_GetElem64x2 = 82650,   861     Iop_GetElem64x2 = 82650,
862     Iop_Dup8x16 = 82651,   862     Iop_Dup8x16 = 82651,
863     Iop_Dup16x8 = 82652,   863     Iop_Dup16x8 = 82652,
864     Iop_Dup32x4 = 82653,   864     Iop_Dup32x4 = 82653,
865     Iop_ExtractV128 = 82654,   865     Iop_ExtractV128 = 82654,
866     Iop_Reverse16_8x16 = 82655,   866     Iop_Reverse16_8x16 = 82655,
867     Iop_Reverse32_8x16 = 82656,   867     Iop_Reverse32_8x16 = 82656,
868     Iop_Reverse32_16x8 = 82657,   868     Iop_Reverse32_16x8 = 82657,
869     Iop_Reverse64_8x16 = 82658,   869     Iop_Reverse64_8x16 = 82658,
870     Iop_Reverse64_16x8 = 82659,   870     Iop_Reverse64_16x8 = 82659,
871     Iop_Reverse64_32x4 = 82660,   871     Iop_Reverse64_32x4 = 82660,
872     Iop_Perm8x16 = 82661,   872     Iop_Perm8x16 = 82661,
873     Iop_Recip32x4 = 82662,   873     Iop_Recip32x4 = 82662,
874     Iop_Rsqrte32x4 = 82663   874     Iop_Rsqrte32x4 = 82663
875 } ;   875 } ;
876 typedef enum __anonenum_IROp_12 IROp;   876 typedef enum __anonenum_IROp_12 IROp;
877 enum __anonenum_IRRoundingMode_13 {   877 enum __anonenum_IRRoundingMode_13 {
878     Irrm_NEAREST = 0,   878     Irrm_NEAREST = 0,
879     Irrm_NegINF = 1,   879     Irrm_NegINF = 1,
880     Irrm_PosINF = 2,   880     Irrm_PosINF = 2,
881     Irrm_ZERO = 3   881     Irrm_ZERO = 3
882 } ;   882 } ;
883 typedef enum __anonenum_IRRoundingMode_13 IRRoundingMode;   883 typedef enum __anonenum_IRRoundingMode_13 IRRoundingMode;
884 enum __anonenum_IRCmpF64Result_14 {   884 enum __anonenum_IRCmpF64Result_14 {
885     Ircr_UN = 69,   885     Ircr_UN = 69,
886     Ircr_LT = 1,   886     Ircr_LT = 1,
887     Ircr_GT = 0,   887     Ircr_GT = 0,
888     Ircr_EQ = 64   888     Ircr_EQ = 64
889 } ;   889 } ;
890 typedef enum __anonenum_IRCmpF64Result_14 IRCmpF64Result;   890 typedef enum __anonenum_IRCmpF64Result_14 IRCmpF64Result;
891 typedef IRCmpF64Result IRCmpF32Result;   891 typedef IRCmpF64Result IRCmpF32Result;
892 typedef IRCmpF64Result IRCmpF128Result;   892 typedef IRCmpF64Result IRCmpF128Result;
893 enum __anonenum_IRExprTag_15 {   893 enum __anonenum_IRExprTag_15 {
894     Iex_Binder = 86016,   894     Iex_Binder = 86016,
895     Iex_Get = 86017,   895     Iex_Get = 86017,
896     Iex_GetI = 86018,   896     Iex_GetI = 86018,
897     Iex_RdTmp = 86019,   897     Iex_RdTmp = 86019,
898     Iex_Qop = 86020,   898     Iex_Qop = 86020,
899     Iex_Triop = 86021,   899     Iex_Triop = 86021,
900     Iex_Binop = 86022,   900     Iex_Binop = 86022,
901     Iex_Unop = 86023,   901     Iex_Unop = 86023,
902     Iex_Load = 86024,   902     Iex_Load = 86024,
903     Iex_Const = 86025,   903     Iex_Const = 86025,
904     Iex_Mux0X = 86026,   904     Iex_Mux0X = 86026,
905     Iex_CCall = 86027   905     Iex_CCall = 86027
906 } ;   906 } ;
907 typedef enum __anonenum_IRExprTag_15 IRExprTag;   907 typedef enum __anonenum_IRExprTag_15 IRExprTag;
908 struct _IRExpr;   908 struct _IRExpr;
909 typedef struct _IRExpr IRExpr;   909 typedef struct _IRExpr IRExpr;
910 struct __anonstruct_Binder_17 {   910 struct __anonstruct_Binder_17 {
911    Int binder ;   911    Int binder ;
912 };   912 };
913 struct __anonstruct_Get_18 {   913 struct __anonstruct_Get_18 {
914    Int offset ;   914    Int offset ;
915    IRType ty ;   915    IRType ty ;
916 };   916 };
917 struct __anonstruct_GetI_19 {   917 struct __anonstruct_GetI_19 {
918    IRRegArray *descr ;   918    IRRegArray *descr ;
919    IRExpr *ix ;   919    IRExpr *ix ;
920    Int bias ;   920    Int bias ;
921 };   921 };
922 struct __anonstruct_RdTmp_20 {   922 struct __anonstruct_RdTmp_20 {
923    IRTemp tmp ;   923    IRTemp tmp ;
924 };   924 };
925 struct __anonstruct_Qop_21 {   925 struct __anonstruct_Qop_21 {
926    IROp op ;   926    IROp op ;
927    IRExpr *arg1 ;   927    IRExpr *arg1 ;
928    IRExpr *arg2 ;   928    IRExpr *arg2 ;
929    IRExpr *arg3 ;   929    IRExpr *arg3 ;
930    IRExpr *arg4 ;   930    IRExpr *arg4 ;
931 };   931 };
932 struct __anonstruct_Triop_22 {   932 struct __anonstruct_Triop_22 {
933    IROp op ;   933    IROp op ;
934    IRExpr *arg1 ;   934    IRExpr *arg1 ;
935    IRExpr *arg2 ;   935    IRExpr *arg2 ;
936    IRExpr *arg3 ;   936    IRExpr *arg3 ;
937 };   937 };
938 struct __anonstruct_Binop_23 {   938 struct __anonstruct_Binop_23 {
939    IROp op ;   939    IROp op ;
940    IRExpr *arg1 ;   940    IRExpr *arg1 ;
941    IRExpr *arg2 ;   941    IRExpr *arg2 ;
942 };   942 };
943 struct __anonstruct_Unop_24 {   943 struct __anonstruct_Unop_24 {
944    IROp op ;   944    IROp op ;
945    IRExpr *arg ;   945    IRExpr *arg ;
946 };   946 };
947 struct __anonstruct_Load_25 {   947 struct __anonstruct_Load_25 {
948    IREndness end ;   948    IREndness end ;
949    IRType ty ;   949    IRType ty ;
950    IRExpr *addr ;   950    IRExpr *addr ;
951 };   951 };
952 struct __anonstruct_Const_26 {   952 struct __anonstruct_Const_26 {
953    IRConst *con ;   953    IRConst *con ;
954 };   954 };
955 struct __anonstruct_CCall_27 {   955 struct __anonstruct_CCall_27 {
956    IRCallee *cee ;   956    IRCallee *cee ;
957    IRType retty ;   957    IRType retty ;
958    IRExpr **args ;   958    IRExpr **args ;
959 };   959 };
960 struct __anonstruct_Mux0X_28 {   960 struct __anonstruct_Mux0X_28 {
961    IRExpr *cond ;   961    IRExpr *cond ;
962    IRExpr *expr0 ;   962    IRExpr *expr0 ;
963    IRExpr *exprX ;   963    IRExpr *exprX ;
964 };   964 };
965 union __anonunion_Iex_16 {   965 union __anonunion_Iex_16 {
966    struct __anonstruct_Binder_17 Binder ;   966    struct __anonstruct_Binder_17 Binder ;
967    struct __anonstruct_Get_18 Get ;   967    struct __anonstruct_Get_18 Get ;
968    struct __anonstruct_GetI_19 GetI ;   968    struct __anonstruct_GetI_19 GetI ;
969    struct __anonstruct_RdTmp_20 RdTmp ;   969    struct __anonstruct_RdTmp_20 RdTmp ;
970    struct __anonstruct_Qop_21 Qop ;   970    struct __anonstruct_Qop_21 Qop ;
971    struct __anonstruct_Triop_22 Triop ;   971    struct __anonstruct_Triop_22 Triop ;
972    struct __anonstruct_Binop_23 Binop ;   972    struct __anonstruct_Binop_23 Binop ;
973    struct __anonstruct_Unop_24 Unop ;   973    struct __anonstruct_Unop_24 Unop ;
974    struct __anonstruct_Load_25 Load ;   974    struct __anonstruct_Load_25 Load ;
975    struct __anonstruct_Const_26 Const ;   975    struct __anonstruct_Const_26 Const ;
976    struct __anonstruct_CCall_27 CCall ;   976    struct __anonstruct_CCall_27 CCall ;
977    struct __anonstruct_Mux0X_28 Mux0X ;   977    struct __anonstruct_Mux0X_28 Mux0X ;
978 };   978 };
979 struct _IRExpr {   979 struct _IRExpr {
980    IRExprTag tag ;   980    IRExprTag tag ;
981    union __anonunion_Iex_16 Iex ;   981    union __anonunion_Iex_16 Iex ;
982 };   982 };
983 enum __anonenum_IRJumpKind_29 {   983 enum __anonenum_IRJumpKind_29 {
984     Ijk_Boring = 90112,   984     Ijk_Boring = 90112,
985     Ijk_Call = 90113,   985     Ijk_Call = 90113,
986     Ijk_Ret = 90114,   986     Ijk_Ret = 90114,
987     Ijk_ClientReq = 90115,   987     Ijk_ClientReq = 90115,
988     Ijk_Yield = 90116,   988     Ijk_Yield = 90116,
989     Ijk_EmWarn = 90117,   989     Ijk_EmWarn = 90117,
990     Ijk_EmFail = 90118,   990     Ijk_EmFail = 90118,
991     Ijk_NoDecode = 90119,   991     Ijk_NoDecode = 90119,
992     Ijk_MapFail = 90120,   992     Ijk_MapFail = 90120,
993     Ijk_TInval = 90121,   993     Ijk_TInval = 90121,
994     Ijk_NoRedir = 90122,   994     Ijk_NoRedir = 90122,
995     Ijk_SigTRAP = 90123,   995     Ijk_SigTRAP = 90123,
996     Ijk_SigSEGV = 90124,   996     Ijk_SigSEGV = 90124,
997     Ijk_SigBUS = 90125,   997     Ijk_SigBUS = 90125,
998     Ijk_Sys_syscall = 90126,   998     Ijk_Sys_syscall = 90126,
999     Ijk_Sys_int32 = 90127,   999     Ijk_Sys_int32 = 90127,
1000     Ijk_Sys_int128 = 90128,   1000     Ijk_Sys_int128 = 90128,
1001     Ijk_Sys_int129 = 90129,   1001     Ijk_Sys_int129 = 90129,
1002     Ijk_Sys_int130 = 90130,   1002     Ijk_Sys_int130 = 90130,
1003     Ijk_Sys_sysenter = 90131   1003     Ijk_Sys_sysenter = 90131
1004 } ;   1004 } ;
1005 typedef enum __anonenum_IRJumpKind_29 IRJumpKind;   1005 typedef enum __anonenum_IRJumpKind_29 IRJumpKind;
1006 enum __anonenum_IREffect_30 {   1006 enum __anonenum_IREffect_30 {
1007     Ifx_None = 94208,   1007     Ifx_None = 94208,
1008     Ifx_Read = 94209,   1008     Ifx_Read = 94209,
1009     Ifx_Write = 94210,   1009     Ifx_Write = 94210,
1010     Ifx_Modify = 94211   1010     Ifx_Modify = 94211
1011 } ;   1011 } ;
1012 typedef enum __anonenum_IREffect_30 IREffect;   1012 typedef enum __anonenum_IREffect_30 IREffect;
1013 struct __anonstruct_fxState_32 {   1013 struct __anonstruct_fxState_32 {
1014    IREffect fx ;   1014    IREffect fx ;
1015    Int offset ;   1015    Int offset ;
1016    Int size ;   1016    Int size ;
1017 };   1017 };
1018 struct __anonstruct_IRDirty_31 {   1018 struct __anonstruct_IRDirty_31 {
1019    IRCallee *cee ;   1019    IRCallee *cee ;
1020    IRExpr *guard ;   1020    IRExpr *guard ;
1021    IRExpr **args ;   1021    IRExpr **args ;
1022    IRTemp tmp ;   1022    IRTemp tmp ;
1023    IREffect mFx ;   1023    IREffect mFx ;
1024    IRExpr *mAddr ;   1024    IRExpr *mAddr ;
1025    Int mSize ;   1025    Int mSize ;
1026    Bool needsBBP ;   1026    Bool needsBBP ;
1027    Int nFxState ;   1027    Int nFxState ;
1028    struct __anonstruct_fxState_32 fxState[7] ;   1028    struct __anonstruct_fxState_32 fxState[7] ;
1029 };   1029 };
1030 typedef struct __anonstruct_IRDirty_31 IRDirty;   1030 typedef struct __anonstruct_IRDirty_31 IRDirty;
1031 enum __anonenum_IRMBusEvent_33 {   1031 enum __anonenum_IRMBusEvent_33 {
1032     Imbe_Fence = 98304   1032     Imbe_Fence = 98304
1033 } ;   1033 } ;
1034 typedef enum __anonenum_IRMBusEvent_33 IRMBusEvent;   1034 typedef enum __anonenum_IRMBusEvent_33 IRMBusEvent;
1035 struct __anonstruct_IRCAS_34 {   1035 struct __anonstruct_IRCAS_34 {
1036    IRTemp oldHi ;   1036    IRTemp oldHi ;
1037    IRTemp oldLo ;   1037    IRTemp oldLo ;
1038    IREndness end ;   1038    IREndness end ;
1039    IRExpr *addr ;   1039    IRExpr *addr ;
1040    IRExpr *expdHi ;   1040    IRExpr *expdHi ;
1041    IRExpr *expdLo ;   1041    IRExpr *expdLo ;
1042    IRExpr *dataHi ;   1042    IRExpr *dataHi ;
1043    IRExpr *dataLo ;   1043    IRExpr *dataLo ;
1044 };   1044 };
1045 typedef struct __anonstruct_IRCAS_34 IRCAS;   1045 typedef struct __anonstruct_IRCAS_34 IRCAS;
1046 enum __anonenum_IRStmtTag_35 {   1046 enum __anonenum_IRStmtTag_35 {
1047     Ist_NoOp = 102400,   1047     Ist_NoOp = 102400,
1048     Ist_IMark = 102401,   1048     Ist_IMark = 102401,
1049     Ist_AbiHint = 102402,   1049     Ist_AbiHint = 102402,
1050     Ist_Put = 102403,   1050     Ist_Put = 102403,
1051     Ist_PutI = 102404,   1051     Ist_PutI = 102404,
1052     Ist_WrTmp = 102405,   1052     Ist_WrTmp = 102405,
1053     Ist_Store = 102406,   1053     Ist_Store = 102406,
1054     Ist_CAS = 102407,   1054     Ist_CAS = 102407,
1055     Ist_LLSC = 102408,   1055     Ist_LLSC = 102408,
1056     Ist_Dirty = 102409,   1056     Ist_Dirty = 102409,
1057     Ist_MBE = 102410,   1057     Ist_MBE = 102410,
1058     Ist_Exit = 102411   1058     Ist_Exit = 102411
1059 } ;   1059 } ;
1060 typedef enum __anonenum_IRStmtTag_35 IRStmtTag;   1060 typedef enum __anonenum_IRStmtTag_35 IRStmtTag;
1061 struct __anonstruct_NoOp_37 {   1061 struct __anonstruct_NoOp_37 {
1062     1062  
1063 };   1063 };
1064 struct __anonstruct_IMark_38 {   1064 struct __anonstruct_IMark_38 {
1065    Addr64 addr ;   1065    Addr64 addr ;
1066    Int len ;   1066    Int len ;
1067 };   1067 };
1068 struct __anonstruct_AbiHint_39 {   1068 struct __anonstruct_AbiHint_39 {
1069    IRExpr *base ;   1069    IRExpr *base ;
1070    Int len ;   1070    Int len ;
1071    IRExpr *nia ;   1071    IRExpr *nia ;
1072 };   1072 };
1073 struct __anonstruct_Put_40 {   1073 struct __anonstruct_Put_40 {
1074    Int offset ;   1074    Int offset ;
1075    IRExpr *data ;   1075    IRExpr *data ;
1076 };   1076 };
1077 struct __anonstruct_PutI_41 {   1077 struct __anonstruct_PutI_41 {
1078    IRRegArray *descr ;   1078    IRRegArray *descr ;
1079    IRExpr *ix ;   1079    IRExpr *ix ;
1080    Int bias ;   1080    Int bias ;
1081    IRExpr *data ;   1081    IRExpr *data ;
1082 };   1082 };
1083 struct __anonstruct_WrTmp_42 {   1083 struct __anonstruct_WrTmp_42 {
1084    IRTemp tmp ;   1084    IRTemp tmp ;
1085    IRExpr *data ;   1085    IRExpr *data ;
1086 };   1086 };
1087 struct __anonstruct_Store_43 {   1087 struct __anonstruct_Store_43 {
1088    IREndness end ;   1088    IREndness end ;
1089    IRExpr *addr ;   1089    IRExpr *addr ;
1090    IRExpr *data ;   1090    IRExpr *data ;
1091 };   1091 };
1092 struct __anonstruct_CAS_44 {   1092 struct __anonstruct_CAS_44 {
1093    IRCAS *details ;   1093    IRCAS *details ;
1094 };   1094 };
1095 struct __anonstruct_LLSC_45 {   1095 struct __anonstruct_LLSC_45 {
1096    IREndness end ;   1096    IREndness end ;
1097    IRTemp result ;   1097    IRTemp result ;
1098    IRExpr *addr ;   1098    IRExpr *addr ;
1099    IRExpr *storedata ;   1099    IRExpr *storedata ;
1100 };   1100 };
1101 struct __anonstruct_Dirty_46 {   1101 struct __anonstruct_Dirty_46 {
1102    IRDirty *details ;   1102    IRDirty *details ;
1103 };   1103 };
1104 struct __anonstruct_MBE_47 {   1104 struct __anonstruct_MBE_47 {
1105    IRMBusEvent event ;   1105    IRMBusEvent event ;
1106 };   1106 };
1107 struct __anonstruct_Exit_48 {   1107 struct __anonstruct_Exit_48 {
1108    IRExpr *guard ;   1108    IRExpr *guard ;
1109    IRJumpKind jk ;   1109    IRJumpKind jk ;
1110    IRConst *dst ;   1110    IRConst *dst ;
1111 };   1111 };
1112 union __anonunion_Ist_36 {   1112 union __anonunion_Ist_36 {
1113    struct __anonstruct_NoOp_37 NoOp ;   1113    struct __anonstruct_NoOp_37 NoOp ;
1114    struct __anonstruct_IMark_38 IMark ;   1114    struct __anonstruct_IMark_38 IMark ;
1115    struct __anonstruct_AbiHint_39 AbiHint ;   1115    struct __anonstruct_AbiHint_39 AbiHint ;
1116    struct __anonstruct_Put_40 Put ;   1116    struct __anonstruct_Put_40 Put ;
1117    struct __anonstruct_PutI_41 PutI ;   1117    struct __anonstruct_PutI_41 PutI ;
1118    struct __anonstruct_WrTmp_42 WrTmp ;   1118    struct __anonstruct_WrTmp_42 WrTmp ;
1119    struct __anonstruct_Store_43 Store ;   1119    struct __anonstruct_Store_43 Store ;
1120    struct __anonstruct_CAS_44 CAS ;   1120    struct __anonstruct_CAS_44 CAS ;
1121    struct __anonstruct_LLSC_45 LLSC ;   1121    struct __anonstruct_LLSC_45 LLSC ;
1122    struct __anonstruct_Dirty_46 Dirty ;   1122    struct __anonstruct_Dirty_46 Dirty ;
1123    struct __anonstruct_MBE_47 MBE ;   1123    struct __anonstruct_MBE_47 MBE ;
1124    struct __anonstruct_Exit_48 Exit ;   1124    struct __anonstruct_Exit_48 Exit ;
1125 };   1125 };
1126 struct _IRStmt {   1126 struct _IRStmt {
1127    IRStmtTag tag ;   1127    IRStmtTag tag ;
1128    union __anonunion_Ist_36 Ist ;   1128    union __anonunion_Ist_36 Ist ;
1129 };   1129 };
1130 typedef struct _IRStmt IRStmt;   1130 typedef struct _IRStmt IRStmt;
1131 struct __anonstruct_IRTypeEnv_49 {   1131 struct __anonstruct_IRTypeEnv_49 {
1132    IRType *types ;   1132    IRType *types ;
1133    Int types_size ;   1133    Int types_size ;
1134    Int types_used ;   1134    Int types_used ;
1135 };   1135 };
1136 typedef struct __anonstruct_IRTypeEnv_49 IRTypeEnv;   1136 typedef struct __anonstruct_IRTypeEnv_49 IRTypeEnv;
1137 struct __anonstruct_IRSB_50 {   1137 struct __anonstruct_IRSB_50 {
1138    IRTypeEnv *tyenv ;   1138    IRTypeEnv *tyenv ;
1139    IRStmt **stmts ;   1139    IRStmt **stmts ;
1140    Int stmts_size ;   1140    Int stmts_size ;
1141    Int stmts_used ;   1141    Int stmts_used ;
1142    IRExpr *next ;   1142    IRExpr *next ;
1143    IRJumpKind jumpkind ;   1143    IRJumpKind jumpkind ;
1144 };   1144 };
1145 typedef struct __anonstruct_IRSB_50 IRSB;   1145 typedef struct __anonstruct_IRSB_50 IRSB;
1146 enum __anonenum_VexArch_51 {   1146 enum __anonenum_VexArch_51 {
1147     VexArch_INVALID = 0,   1147     VexArch_INVALID = 0,
1148     VexArchX86 = 1,   1148     VexArchX86 = 1,
1149     VexArchAMD64 = 2,   1149     VexArchAMD64 = 2,
1150     VexArchARM = 3,   1150     VexArchARM = 3,
1151     VexArchPPC32 = 4,   1151     VexArchPPC32 = 4,
1152     VexArchPPC64 = 5,   1152     VexArchPPC64 = 5,
1153     VexArchS390X = 6   1153     VexArchS390X = 6
1154 } ;   1154 } ;
1155 typedef enum __anonenum_VexArch_51 VexArch;   1155 typedef enum __anonenum_VexArch_51 VexArch;
1156 struct __anonstruct_VexArchInfo_52 {   1156 struct __anonstruct_VexArchInfo_52 {
1157    UInt hwcaps ;   1157    UInt hwcaps ;
1158    Int ppc_cache_line_szB ;   1158    Int ppc_cache_line_szB ;
1159    UInt ppc_dcbz_szB ;   1159    UInt ppc_dcbz_szB ;
1160    UInt ppc_dcbzl_szB ;   1160    UInt ppc_dcbzl_szB ;
1161 };   1161 };
1162 typedef struct __anonstruct_VexArchInfo_52 VexArchInfo;   1162 typedef struct __anonstruct_VexArchInfo_52 VexArchInfo;
1163 struct __anonstruct_VexAbiInfo_53 {   1163 struct __anonstruct_VexAbiInfo_53 {
1164    Int guest_stack_redzone_size ;   1164    Int guest_stack_redzone_size ;
1165    Bool guest_amd64_assume_fs_is_zero ;   1165    Bool guest_amd64_assume_fs_is_zero ;
1166    Bool guest_amd64_assume_gs_is_0x60 ;   1166    Bool guest_amd64_assume_gs_is_0x60 ;
1167    Bool guest_ppc_zap_RZ_at_blr ;   1167    Bool guest_ppc_zap_RZ_at_blr ;
1168    Bool (*guest_ppc_zap_RZ_at_bl)(Addr64  ) ;   1168    Bool (*guest_ppc_zap_RZ_at_bl)(Addr64  ) ;
1169    Bool guest_ppc_sc_continues_at_LR ;   1169    Bool guest_ppc_sc_continues_at_LR ;
1170    Bool host_ppc_calls_use_fndescrs ;   1170    Bool host_ppc_calls_use_fndescrs ;
1171    Bool host_ppc32_regalign_int64_args ;   1171    Bool host_ppc32_regalign_int64_args ;
1172 };   1172 };
1173 typedef struct __anonstruct_VexAbiInfo_53 VexAbiInfo;   1173 typedef struct __anonstruct_VexAbiInfo_53 VexAbiInfo;
1174 struct __anonstruct_VexControl_54 {   1174 struct __anonstruct_VexControl_54 {
1175    Int iropt_verbosity ;   1175    Int iropt_verbosity ;
1176    Int iropt_level ;   1176    Int iropt_level ;
1177    Bool iropt_precise_memory_exns ;   1177    Bool iropt_precise_memory_exns ;
1178    Int iropt_unroll_thresh ;   1178    Int iropt_unroll_thresh ;
1179    Int guest_max_insns ;   1179    Int guest_max_insns ;
1180    Int guest_chase_thresh ;   1180    Int guest_chase_thresh ;
1181    Bool guest_chase_cond ;   1181    Bool guest_chase_cond ;
1182 };   1182 };
1183 typedef struct __anonstruct_VexControl_54 VexControl;   1183 typedef struct __anonstruct_VexControl_54 VexControl;
1184 struct __anonstruct_alwaysDefd_56 {   1184 struct __anonstruct_alwaysDefd_56 {
1185    Int offset ;   1185    Int offset ;
1186    Int size ;   1186    Int size ;
1187 };   1187 };
1188 struct __anonstruct_VexGuestLayout_55 {   1188 struct __anonstruct_VexGuestLayout_55 {
1189    Int total_sizeB ;   1189    Int total_sizeB ;
1190    Int offset_SP ;   1190    Int offset_SP ;
1191    Int sizeof_SP ;   1191    Int sizeof_SP ;
1192    Int offset_FP ;   1192    Int offset_FP ;
1193    Int sizeof_FP ;   1193    Int sizeof_FP ;
1194    Int offset_IP ;   1194    Int offset_IP ;
1195    Int sizeof_IP ;   1195    Int sizeof_IP ;
1196    Int n_alwaysDefd ;   1196    Int n_alwaysDefd ;
1197    struct __anonstruct_alwaysDefd_56 alwaysDefd[24] ;   1197    struct __anonstruct_alwaysDefd_56 alwaysDefd[24] ;
1198 };   1198 };
1199 typedef struct __anonstruct_VexGuestLayout_55 VexGuestLayout;   1199 typedef struct __anonstruct_VexGuestLayout_55 VexGuestLayout;
1200 enum __anonenum_VexTranslateResult_57 {   1200 enum __anonenum_VexTranslateResult_57 {
1201     VexTransOK = 0,   1201     VexTransOK = 0,
1202     VexTransAccessFail = 1,   1202     VexTransAccessFail = 1,
1203     VexTransOutputFull = 2   1203     VexTransOutputFull = 2
1204 } ;   1204 } ;
1205 typedef enum __anonenum_VexTranslateResult_57 VexTranslateResult;   1205 typedef enum __anonenum_VexTranslateResult_57 VexTranslateResult;
1206 struct __anonstruct_VexGuestExtents_58 {   1206 struct __anonstruct_VexGuestExtents_58 {
1207    Addr64 base[3] ;   1207    Addr64 base[3] ;
1208    UShort len[3] ;   1208    UShort len[3] ;
1209    UShort n_used ;   1209    UShort n_used ;
1210 };   1210 };
1211 typedef struct __anonstruct_VexGuestExtents_58 VexGuestExtents;   1211 typedef struct __anonstruct_VexGuestExtents_58 VexGuestExtents;
1212 struct __anonstruct_VexTranslateArgs_59 {   1212 struct __anonstruct_VexTranslateArgs_59 {
1213    VexArch arch_guest ;   1213    VexArch arch_guest ;
1214    VexArchInfo archinfo_guest ;   1214    VexArchInfo archinfo_guest ;
1215    VexArch arch_host ;   1215    VexArch arch_host ;
1216    VexArchInfo archinfo_host ;   1216    VexArchInfo archinfo_host ;
1217    VexAbiInfo abiinfo_both ;   1217    VexAbiInfo abiinfo_both ;
1218    void *callback_opaque ;   1218    void *callback_opaque ;
1219    UChar *guest_bytes ;   1219    UChar *guest_bytes ;
1220    Addr64 guest_bytes_addr ;   1220    Addr64 guest_bytes_addr ;
1221    Bool (*chase_into_ok)(void * , Addr64  ) ;   1221    Bool (*chase_into_ok)(void * , Addr64  ) ;
1222    VexGuestExtents *guest_extents ;   1222    VexGuestExtents *guest_extents ;
1223    UChar *host_bytes ;   1223    UChar *host_bytes ;
1224    Int host_bytes_size ;   1224    Int host_bytes_size ;
1225    Int *host_bytes_used ;   1225    Int *host_bytes_used ;
1226    IRSB *(*instrument1)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,   1226    IRSB *(*instrument1)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,
1227                         IRType gWordTy , IRType hWordTy ) ;   1227                         IRType gWordTy , IRType hWordTy ) ;
1228    IRSB *(*instrument2)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,   1228    IRSB *(*instrument2)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,
1229                         IRType gWordTy , IRType hWordTy ) ;   1229                         IRType gWordTy , IRType hWordTy ) ;
1230    IRSB *(*finaltidy)(IRSB * ) ;   1230    IRSB *(*finaltidy)(IRSB * ) ;
1231    Bool do_self_check ;   1231    Bool do_self_check ;
1232    Bool (*preamble_function)(void * , IRSB * ) ;   1232    Bool (*preamble_function)(void * , IRSB * ) ;
1233    Int traceflags ;   1233    Int traceflags ;
1234    void *dispatch ;   1234    void *dispatch ;
1235 };   1235 };
1236 typedef struct __anonstruct_VexTranslateArgs_59 VexTranslateArgs;   1236 typedef struct __anonstruct_VexTranslateArgs_59 VexTranslateArgs;
1237 struct __anonstruct_VgCallbackClosure_60 {   1237 struct __anonstruct_VgCallbackClosure_60 {
1238    Addr64 nraddr ;   1238    Addr64 nraddr ;
1239    Addr64 readdr ;   1239    Addr64 readdr ;
1240    ThreadId tid ;   1240    ThreadId tid ;
1241 };   1241 };
1242 typedef struct __anonstruct_VgCallbackClosure_60 VgCallbackClosure;   1242 typedef struct __anonstruct_VgCallbackClosure_60 VgCallbackClosure;
1243 enum __anonenum_CorePart_61 {   1243 enum __anonenum_CorePart_61 {
1244     Vg_CoreStartup = 1,   1244     Vg_CoreStartup = 1,
1245     Vg_CoreSignal = 2,   1245     Vg_CoreSignal = 2,
1246     Vg_CoreSysCall = 3,   1246     Vg_CoreSysCall = 3,
1247     Vg_CoreSysCallArgInMem = 4,   1247     Vg_CoreSysCallArgInMem = 4,
1248     Vg_CoreTranslate = 5,   1248     Vg_CoreTranslate = 5,
1249     Vg_CoreClientReq = 6   1249     Vg_CoreClientReq = 6
1250 } ;   1250 } ;
1251 typedef enum __anonenum_CorePart_61 CorePart;   1251 typedef enum __anonenum_CorePart_61 CorePart;
1252 struct _VgHashNode {   1252 struct _VgHashNode {
1253    struct _VgHashNode *next ;   1253    struct _VgHashNode *next ;
1254    UWord key ;   1254    UWord key ;
1255 };   1255 };
1256 typedef struct _VgHashNode VgHashNode;   1256 typedef struct _VgHashNode VgHashNode;
1257 struct _VgHashTable;   1257 struct _VgHashTable;
1258 typedef struct _VgHashTable *VgHashTable;   1258 typedef struct _VgHashTable *VgHashTable;
1259 struct _XArray;   1259 struct _XArray;
1260 typedef struct _XArray XArray;   1260 typedef struct _XArray XArray;
1261 typedef Addr *StackTrace;   1261 typedef Addr *StackTrace;
1262 struct _WordFM;   1262 struct _WordFM;
1263 typedef struct _WordFM WordFM;   1263 typedef struct _WordFM WordFM;
1264 struct _WordBag;   1264 struct _WordBag;
1265 typedef struct _WordBag WordBag;   1265 typedef struct _WordBag WordBag;
1266 enum __anonenum_Vg_FnNameKind_62 {   1266 enum __anonenum_Vg_FnNameKind_62 {
1267     Vg_FnNameNormal = 0,   1267     Vg_FnNameNormal = 0,
1268     Vg_FnNameMain = 1,   1268     Vg_FnNameMain = 1,
1269     Vg_FnNameBelowMain = 2   1269     Vg_FnNameBelowMain = 2
1270 } ;   1270 } ;
1271 typedef enum __anonenum_Vg_FnNameKind_62 Vg_FnNameKind;   1271 typedef enum __anonenum_Vg_FnNameKind_62 Vg_FnNameKind;
1272 struct __anonstruct_StackBlock_63 {   1272 struct __anonstruct_StackBlock_63 {
1273    PtrdiffT base ;   1273    PtrdiffT base ;
1274    SizeT szB ;   1274    SizeT szB ;
1275    Bool spRel ;   1275    Bool spRel ;
1276    Bool isVec ;   1276    Bool isVec ;
1277    HChar name[16] ;   1277    HChar name[16] ;
1278 };   1278 };
1279 typedef struct __anonstruct_StackBlock_63 StackBlock;   1279 typedef struct __anonstruct_StackBlock_63 StackBlock;
1280 struct __anonstruct_GlobalBlock_64 {   1280 struct __anonstruct_GlobalBlock_64 {
1281    Addr addr ;   1281    Addr addr ;
1282    SizeT szB ;   1282    SizeT szB ;
1283    Bool isVec ;   1283    Bool isVec ;
1284    HChar name[16] ;   1284    HChar name[16] ;
1285    HChar soname[16] ;   1285    HChar soname[16] ;
1286 };   1286 };
1287 typedef struct __anonstruct_GlobalBlock_64 GlobalBlock;   1287 typedef struct __anonstruct_GlobalBlock_64 GlobalBlock;
1288 struct _DebugInfo;   1288 struct _DebugInfo;
1289 typedef struct _DebugInfo DebugInfo;   1289 typedef struct _DebugInfo DebugInfo;
1290 enum __anonenum_VgSectKind_65 {   1290 enum __anonenum_VgSectKind_65 {
1291     Vg_SectUnknown = 0,   1291     Vg_SectUnknown = 0,
1292     Vg_SectText = 1,   1292     Vg_SectText = 1,
1293     Vg_SectData = 2,   1293     Vg_SectData = 2,
1294     Vg_SectBSS = 3,   1294     Vg_SectBSS = 3,
1295     Vg_SectGOT = 4,   1295     Vg_SectGOT = 4,
1296     Vg_SectPLT = 5,   1296     Vg_SectPLT = 5,
1297     Vg_SectGOTPLT = 6,   1297     Vg_SectGOTPLT = 6,
1298     Vg_SectOPD = 7   1298     Vg_SectOPD = 7
1299 } ;   1299 } ;
1300 typedef enum __anonenum_VgSectKind_65 VgSectKind;   1300 typedef enum __anonenum_VgSectKind_65 VgSectKind;
1301 typedef unsigned short __vki_kernel_mode_t;   1301 typedef unsigned short __vki_kernel_mode_t;
1302 typedef long __vki_kernel_off_t;   1302 typedef long __vki_kernel_off_t;
1303 typedef int __vki_kernel_pid_t;   1303 typedef int __vki_kernel_pid_t;
1304 typedef unsigned short __vki_kernel_ipc_pid_t;   1304 typedef unsigned short __vki_kernel_ipc_pid_t;
1305 typedef unsigned short __vki_kernel_uid_t;   1305 typedef unsigned short __vki_kernel_uid_t;
1306 typedef unsigned short __vki_kernel_gid_t;   1306 typedef unsigned short __vki_kernel_gid_t;
1307 typedef unsigned int __vki_kernel_size_t;   1307 typedef unsigned int __vki_kernel_size_t;
1308 typedef long __vki_kernel_time_t;   1308 typedef long __vki_kernel_time_t;
1309 typedef long __vki_kernel_suseconds_t;   1309 typedef long __vki_kernel_suseconds_t;
1310 typedef long __vki_kernel_clock_t;   1310 typedef long __vki_kernel_clock_t;
1311 typedef int __vki_kernel_timer_t;   1311 typedef int __vki_kernel_timer_t;
1312 typedef int __vki_kernel_clockid_t;   1312 typedef int __vki_kernel_clockid_t;
1313 typedef char *__vki_kernel_caddr_t;   1313 typedef char *__vki_kernel_caddr_t;
1314 typedef unsigned int __vki_kernel_uid32_t;   1314 typedef unsigned int __vki_kernel_uid32_t;
1315 typedef unsigned int __vki_kernel_gid32_t;   1315 typedef unsigned int __vki_kernel_gid32_t;
1316 typedef unsigned short __vki_kernel_old_uid_t;   1316 typedef unsigned short __vki_kernel_old_uid_t;
1317 typedef unsigned short __vki_kernel_old_gid_t;   1317 typedef unsigned short __vki_kernel_old_gid_t;
1318 typedef long long __vki_kernel_loff_t;   1318 typedef long long __vki_kernel_loff_t;
1319 struct __anonstruct___vki_kernel_fsid_t_66 {   1319 struct __anonstruct___vki_kernel_fsid_t_66 {
1320    int val[2] ;   1320    int val[2] ;
1321 };   1321 };
1322 typedef struct __anonstruct___vki_kernel_fsid_t_66 __vki_kernel_fsid_t;   1322 typedef struct __anonstruct___vki_kernel_fsid_t_66 __vki_kernel_fsid_t;
1323 struct __anonstruct___vki_kernel_fd_set_67 {   1323 struct __anonstruct___vki_kernel_fd_set_67 {
1324    unsigned long fds_bits[1024U / (8U * sizeof(unsigned long ))] ;   1324    unsigned long fds_bits[1024U / (8U * sizeof(unsigned long ))] ;
1325 };   1325 };
1326 typedef struct __anonstruct___vki_kernel_fd_set_67 __vki_kernel_fd_set;   1326 typedef struct __anonstruct___vki_kernel_fd_set_67 __vki_kernel_fd_set;
1327 typedef int __vki_kernel_key_t;   1327 typedef int __vki_kernel_key_t;
1328 typedef int __vki_kernel_mqd_t;   1328 typedef int __vki_kernel_mqd_t;
1329 typedef __vki_kernel_fd_set vki_fd_set;   1329 typedef __vki_kernel_fd_set vki_fd_set;
1330 typedef __vki_kernel_mode_t vki_mode_t;   1330 typedef __vki_kernel_mode_t vki_mode_t;
1331 typedef __vki_kernel_off_t vki_off_t;   1331 typedef __vki_kernel_off_t vki_off_t;
1332 typedef __vki_kernel_pid_t vki_pid_t;   1332 typedef __vki_kernel_pid_t vki_pid_t;
1333 typedef __vki_kernel_key_t vki_key_t;   1333 typedef __vki_kernel_key_t vki_key_t;
1334 typedef __vki_kernel_suseconds_t vki_suseconds_t;   1334 typedef __vki_kernel_suseconds_t vki_suseconds_t;
1335 typedef __vki_kernel_timer_t vki_timer_t;   1335 typedef __vki_kernel_timer_t vki_timer_t;
1336 typedef __vki_kernel_clockid_t vki_clockid_t;   1336 typedef __vki_kernel_clockid_t vki_clockid_t;
1337 typedef __vki_kernel_mqd_t vki_mqd_t;   1337 typedef __vki_kernel_mqd_t vki_mqd_t;
1338 typedef __vki_kernel_uid32_t vki_uid_t;   1338 typedef __vki_kernel_uid32_t vki_uid_t;
1339 typedef __vki_kernel_gid32_t vki_gid_t;   1339 typedef __vki_kernel_gid32_t vki_gid_t;
1340 typedef __vki_kernel_old_uid_t vki_old_uid_t;   1340 typedef __vki_kernel_old_uid_t vki_old_uid_t;
1341 typedef __vki_kernel_old_gid_t vki_old_gid_t;   1341 typedef __vki_kernel_old_gid_t vki_old_gid_t;
1342 typedef __vki_kernel_loff_t vki_loff_t;   1342 typedef __vki_kernel_loff_t vki_loff_t;
1343 typedef __vki_kernel_size_t vki_size_t;   1343 typedef __vki_kernel_size_t vki_size_t;
1344 typedef __vki_kernel_time_t vki_time_t;   1344 typedef __vki_kernel_time_t vki_time_t;
1345 typedef __vki_kernel_clock_t vki_clock_t;   1345 typedef __vki_kernel_clock_t vki_clock_t;
1346 typedef __vki_kernel_caddr_t vki_caddr_t;   1346 typedef __vki_kernel_caddr_t vki_caddr_t;
1347 typedef unsigned long vki_u_long;   1347 typedef unsigned long vki_u_long;
1348 typedef unsigned int vki_uint;   1348 typedef unsigned int vki_uint;
1349 typedef unsigned char __vki_u8;   1349 typedef unsigned char __vki_u8;
1350 typedef short __vki_s16;   1350 typedef short __vki_s16;
1351 typedef unsigned short __vki_u16;   1351 typedef unsigned short __vki_u16;
1352 typedef int __vki_s32;   1352 typedef int __vki_s32;
1353 typedef unsigned int __vki_u32;   1353 typedef unsigned int __vki_u32;
1354 typedef long long __vki_s64;   1354 typedef long long __vki_s64;
1355 typedef unsigned long long __vki_u64;   1355 typedef unsigned long long __vki_u64;
1356 typedef unsigned short vki_u16;   1356 typedef unsigned short vki_u16;
1357 typedef unsigned int vki_u32;   1357 typedef unsigned int vki_u32;
1358 typedef void __vki_signalfn_t(int  );   1358 typedef void __vki_signalfn_t(int  );
1359 typedef __vki_signalfn_t *__vki_sighandler_t;   1359 typedef __vki_signalfn_t *__vki_sighandler_t;
1360 typedef void __vki_restorefn_t(void);   1360 typedef void __vki_restorefn_t(void);
1361 typedef __vki_restorefn_t *__vki_sigrestore_t;   1361 typedef __vki_restorefn_t *__vki_sigrestore_t;
1362 typedef unsigned long vki_old_sigset_t;   1362 typedef unsigned long vki_old_sigset_t;
1363 struct __anonstruct_vki_sigset_t_68 {   1363 struct __anonstruct_vki_sigset_t_68 {
1364    unsigned long sig[2] ;   1364    unsigned long sig[2] ;
1365 };   1365 };
1366 typedef struct __anonstruct_vki_sigset_t_68 vki_sigset_t;   1366 typedef struct __anonstruct_vki_sigset_t_68 vki_sigset_t;
1367 struct vki_old_sigaction {   1367 struct vki_old_sigaction {
1368    __vki_sighandler_t ksa_handler ;   1368    __vki_sighandler_t ksa_handler ;
1369    vki_old_sigset_t sa_mask ;   1369    vki_old_sigset_t sa_mask ;
1370    unsigned long sa_flags ;   1370    unsigned long sa_flags ;
1371    __vki_sigrestore_t sa_restorer ;   1371    __vki_sigrestore_t sa_restorer ;
1372 };   1372 };
1373 struct vki_sigaction_base {   1373 struct vki_sigaction_base {
1374    __vki_sighandler_t ksa_handler ;   1374    __vki_sighandler_t ksa_handler ;
1375    unsigned long sa_flags ;   1375    unsigned long sa_flags ;
1376    __vki_sigrestore_t sa_restorer ;   1376    __vki_sigrestore_t sa_restorer ;
1377    vki_sigset_t sa_mask ;   1377    vki_sigset_t sa_mask ;
1378 };   1378 };
1379 typedef struct vki_sigaction_base vki_sigaction_toK_t;   1379 typedef struct vki_sigaction_base vki_sigaction_toK_t;
1380 typedef struct vki_sigaction_base vki_sigaction_fromK_t;   1380 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
1381 struct vki_sigaltstack {   1381 struct vki_sigaltstack {
1382    void *ss_sp ;   1382    void *ss_sp ;
1383    int ss_flags ;   1383    int ss_flags ;
1384    vki_size_t ss_size ;   1384    vki_size_t ss_size ;
1385 };   1385 };
1386 typedef struct vki_sigaltstack vki_stack_t;   1386 typedef struct vki_sigaltstack vki_stack_t;
1387 struct _vki_fpreg {   1387 struct _vki_fpreg {
1388    unsigned short significand[4] ;   1388    unsigned short significand[4] ;
1389    unsigned short exponent ;   1389    unsigned short exponent ;
1390 };   1390 };
1391 struct _vki_fpxreg {   1391 struct _vki_fpxreg {
1392    unsigned short significand[4] ;   1392    unsigned short significand[4] ;
1393    unsigned short exponent ;   1393    unsigned short exponent ;
1394    unsigned short padding[3] ;   1394    unsigned short padding[3] ;
1395 };   1395 };
1396 struct _vki_xmmreg {   1396 struct _vki_xmmreg {
1397    unsigned long element[4] ;   1397    unsigned long element[4] ;
1398 };   1398 };
1399 struct _vki_fpstate {   1399 struct _vki_fpstate {
1400    unsigned long cw ;   1400    unsigned long cw ;
1401    unsigned long sw ;   1401    unsigned long sw ;
1402    unsigned long tag ;   1402    unsigned long tag ;
1403    unsigned long ipoff ;   1403    unsigned long ipoff ;
1404    unsigned long cssel ;   1404    unsigned long cssel ;
1405    unsigned long dataoff ;   1405    unsigned long dataoff ;
1406    unsigned long datasel ;   1406    unsigned long datasel ;
1407    struct _vki_fpreg _st[8] ;   1407    struct _vki_fpreg _st[8] ;
1408    unsigned short status ;   1408    unsigned short status ;
1409    unsigned short magic ;   1409    unsigned short magic ;
1410    unsigned long _fxsr_env[6] ;   1410    unsigned long _fxsr_env[6] ;
1411    unsigned long mxcsr ;   1411    unsigned long mxcsr ;
1412    unsigned long reserved ;   1412    unsigned long reserved ;
1413    struct _vki_fpxreg _fxsr_st[8] ;   1413    struct _vki_fpxreg _fxsr_st[8] ;
1414    struct _vki_xmmreg _xmm[8] ;   1414    struct _vki_xmmreg _xmm[8] ;
1415    unsigned long padding[56] ;   1415    unsigned long padding[56] ;
1416 };   1416 };
1417 struct vki_sigcontext {   1417 struct vki_sigcontext {
1418    unsigned short gs ;   1418    unsigned short gs ;
1419    unsigned short __gsh ;   1419    unsigned short __gsh ;
1420    unsigned short fs ;   1420    unsigned short fs ;
1421    unsigned short __fsh ;   1421    unsigned short __fsh ;
1422    unsigned short es ;   1422    unsigned short es ;
1423    unsigned short __esh ;   1423    unsigned short __esh ;
1424    unsigned short ds ;   1424    unsigned short ds ;
1425    unsigned short __dsh ;   1425    unsigned short __dsh ;
1426    unsigned long edi ;   1426    unsigned long edi ;
1427    unsigned long esi ;   1427    unsigned long esi ;
1428    unsigned long ebp ;   1428    unsigned long ebp ;
1429    unsigned long esp ;   1429    unsigned long esp ;
1430    unsigned long ebx ;   1430    unsigned long ebx ;
1431    unsigned long edx ;   1431    unsigned long edx ;
1432    unsigned long ecx ;   1432    unsigned long ecx ;
1433    unsigned long eax ;   1433    unsigned long eax ;
1434    unsigned long trapno ;   1434    unsigned long trapno ;
1435    unsigned long err ;   1435    unsigned long err ;
1436    unsigned long eip ;   1436    unsigned long eip ;
1437    unsigned short cs ;   1437    unsigned short cs ;
1438    unsigned short __csh ;   1438    unsigned short __csh ;
1439    unsigned long eflags ;   1439    unsigned long eflags ;
1440    unsigned long esp_at_signal ;   1440    unsigned long esp_at_signal ;
1441    unsigned short ss ;   1441    unsigned short ss ;
1442    unsigned short __ssh ;   1442    unsigned short __ssh ;
1443    struct _vki_fpstate *fpstate ;   1443    struct _vki_fpstate *fpstate ;
1444    unsigned long oldmask ;   1444    unsigned long oldmask ;
1445    unsigned long cr2 ;   1445    unsigned long cr2 ;
1446 };   1446 };
1447 struct vki_stat {   1447 struct vki_stat {
1448    unsigned long st_dev ;   1448    unsigned long st_dev ;
1449    unsigned long st_ino ;   1449    unsigned long st_ino ;
1450    unsigned short st_mode ;   1450    unsigned short st_mode ;
1451    unsigned short st_nlink ;   1451    unsigned short st_nlink ;
1452    unsigned short st_uid ;   1452    unsigned short st_uid ;
1453    unsigned short st_gid ;   1453    unsigned short st_gid ;
1454    unsigned long st_rdev ;   1454    unsigned long st_rdev ;
1455    unsigned long st_size ;   1455    unsigned long st_size ;
1456    unsigned long st_blksize ;   1456    unsigned long st_blksize ;
1457    unsigned long st_blocks ;   1457    unsigned long st_blocks ;
1458    unsigned long st_atime ;   1458    unsigned long st_atime ;
1459    unsigned long st_atime_nsec ;   1459    unsigned long st_atime_nsec ;
1460    unsigned long st_mtime ;   1460    unsigned long st_mtime ;
1461    unsigned long st_mtime_nsec ;   1461    unsigned long st_mtime_nsec ;
1462    unsigned long st_ctime ;   1462    unsigned long st_ctime ;
1463    unsigned long st_ctime_nsec ;   1463    unsigned long st_ctime_nsec ;
1464    unsigned long __unused4 ;   1464    unsigned long __unused4 ;
1465    unsigned long __unused5 ;   1465    unsigned long __unused5 ;
1466 };   1466 };
1467 struct vki_stat64 {   1467 struct vki_stat64 {
1468    unsigned long long st_dev ;   1468    unsigned long long st_dev ;
1469    unsigned char __pad0[4] ;   1469    unsigned char __pad0[4] ;
1470    unsigned long __st_ino ;   1470    unsigned long __st_ino ;
1471    unsigned int st_mode ;   1471    unsigned int st_mode ;
1472    unsigned int st_nlink ;   1472    unsigned int st_nlink ;
1473    unsigned long st_uid ;   1473    unsigned long st_uid ;
1474    unsigned long st_gid ;   1474    unsigned long st_gid ;
1475    unsigned long long st_rdev ;   1475    unsigned long long st_rdev ;
1476    unsigned char __pad3[4] ;   1476    unsigned char __pad3[4] ;
1477    long long st_size ;   1477    long long st_size ;
1478    unsigned long st_blksize ;   1478    unsigned long st_blksize ;
1479    unsigned long st_blocks ;   1479    unsigned long st_blocks ;
1480    unsigned long __pad4 ;   1480    unsigned long __pad4 ;
1481    unsigned long st_atime ;   1481    unsigned long st_atime ;
1482    unsigned long st_atime_nsec ;   1482    unsigned long st_atime_nsec ;
1483    unsigned long st_mtime ;   1483    unsigned long st_mtime ;
1484    unsigned int st_mtime_nsec ;   1484    unsigned int st_mtime_nsec ;
1485    unsigned long st_ctime ;   1485    unsigned long st_ctime ;
1486    unsigned long st_ctime_nsec ;   1486    unsigned long st_ctime_nsec ;
1487    unsigned long long st_ino ;   1487    unsigned long long st_ino ;
1488 };   1488 };
1489 struct vki_statfs {   1489 struct vki_statfs {
1490    __vki_u32 f_type ;   1490    __vki_u32 f_type ;
1491    __vki_u32 f_bsize ;   1491    __vki_u32 f_bsize ;
1492    __vki_u32 f_blocks ;   1492    __vki_u32 f_blocks ;
1493    __vki_u32 f_bfree ;   1493    __vki_u32 f_bfree ;
1494    __vki_u32 f_bavail ;   1494    __vki_u32 f_bavail ;
1495    __vki_u32 f_files ;   1495    __vki_u32 f_files ;
1496    __vki_u32 f_ffree ;   1496    __vki_u32 f_ffree ;
1497    __vki_kernel_fsid_t f_fsid ;   1497    __vki_kernel_fsid_t f_fsid ;
1498    __vki_u32 f_namelen ;   1498    __vki_u32 f_namelen ;
1499    __vki_u32 f_frsize ;   1499    __vki_u32 f_frsize ;
1500    __vki_u32 f_spare[5] ;   1500    __vki_u32 f_spare[5] ;
1501 };   1501 };
1502 struct vki_winsize {   1502 struct vki_winsize {
1503    unsigned short ws_row ;   1503    unsigned short ws_row ;
1504    unsigned short ws_col ;   1504    unsigned short ws_col ;
1505    unsigned short ws_xpixel ;   1505    unsigned short ws_xpixel ;
1506    unsigned short ws_ypixel ;   1506    unsigned short ws_ypixel ;
1507 };   1507 };
1508 struct vki_termio {   1508 struct vki_termio {
1509    unsigned short c_iflag ;   1509    unsigned short c_iflag ;
1510    unsigned short c_oflag ;   1510    unsigned short c_oflag ;
1511    unsigned short c_cflag ;   1511    unsigned short c_cflag ;
1512    unsigned short c_lflag ;   1512    unsigned short c_lflag ;
1513    unsigned char c_line ;   1513    unsigned char c_line ;
1514    unsigned char c_cc[8] ;   1514    unsigned char c_cc[8] ;
1515 };   1515 };
1516 typedef unsigned char vki_cc_t;   1516 typedef unsigned char vki_cc_t;
1517 typedef unsigned int vki_tcflag_t;   1517 typedef unsigned int vki_tcflag_t;
1518 struct vki_termios {   1518 struct vki_termios {
1519    vki_tcflag_t c_iflag ;   1519    vki_tcflag_t c_iflag ;
1520    vki_tcflag_t c_oflag ;   1520    vki_tcflag_t c_oflag ;
1521    vki_tcflag_t c_cflag ;   1521    vki_tcflag_t c_cflag ;
1522    vki_tcflag_t c_lflag ;   1522    vki_tcflag_t c_lflag ;
1523    vki_cc_t c_line ;   1523    vki_cc_t c_line ;
1524    vki_cc_t c_cc[19] ;   1524    vki_cc_t c_cc[19] ;
1525 };   1525 };
1526 struct vki_pollfd {   1526 struct vki_pollfd {
1527    int fd ;   1527    int fd ;
1528    short events ;   1528    short events ;
1529    short revents ;   1529    short revents ;
1530 };   1530 };
1531 struct vki_user_i387_struct {   1531 struct vki_user_i387_struct {
1532    long cwd ;   1532    long cwd ;
1533    long swd ;   1533    long swd ;
1534    long twd ;   1534    long twd ;
1535    long fip ;   1535    long fip ;
1536    long fcs ;   1536    long fcs ;
1537    long foo ;   1537    long foo ;
1538    long fos ;   1538    long fos ;
1539    long st_space[20] ;   1539    long st_space[20] ;
1540 };   1540 };
1541 struct vki_user_fxsr_struct {   1541 struct vki_user_fxsr_struct {
1542    unsigned short cwd ;   1542    unsigned short cwd ;
1543    unsigned short swd ;   1543    unsigned short swd ;
1544    unsigned short twd ;   1544    unsigned short twd ;
1545    unsigned short fop ;   1545    unsigned short fop ;
1546    long fip ;   1546    long fip ;
1547    long fcs ;   1547    long fcs ;
1548    long foo ;   1548    long foo ;
1549    long fos ;   1549    long fos ;
1550    long mxcsr ;   1550    long mxcsr ;
1551    long reserved ;   1551    long reserved ;
1552    long st_space[32] ;   1552    long st_space[32] ;
1553    long xmm_space[32] ;   1553    long xmm_space[32] ;
1554    long padding[56] ;   1554    long padding[56] ;
1555 };   1555 };
1556 struct vki_user_regs_struct {   1556 struct vki_user_regs_struct {
1557    long ebx ;   1557    long ebx ;
1558    long ecx ;   1558    long ecx ;
1559    long edx ;   1559    long edx ;
1560    long esi ;   1560    long esi ;
1561    long edi ;   1561    long edi ;
1562    long ebp ;   1562    long ebp ;
1563    long eax ;   1563    long eax ;
1564    unsigned short ds ;   1564    unsigned short ds ;
1565    unsigned short __ds ;   1565    unsigned short __ds ;
1566    unsigned short es ;   1566    unsigned short es ;
1567    unsigned short __es ;   1567    unsigned short __es ;
1568    unsigned short fs ;   1568    unsigned short fs ;
1569    unsigned short __fs ;   1569    unsigned short __fs ;
1570    unsigned short gs ;   1570    unsigned short gs ;
1571    unsigned short __gs ;   1571    unsigned short __gs ;
1572    long orig_eax ;   1572    long orig_eax ;
1573    long eip ;   1573    long eip ;
1574    unsigned short cs ;   1574    unsigned short cs ;
1575    unsigned short __cs ;   1575    unsigned short __cs ;
1576    long eflags ;   1576    long eflags ;
1577    long esp ;   1577    long esp ;
1578    unsigned short ss ;   1578    unsigned short ss ;
1579    unsigned short __ss ;   1579    unsigned short __ss ;
1580 };   1580 };
1581 typedef unsigned long vki_elf_greg_t;   1581 typedef unsigned long vki_elf_greg_t;
1582 typedef vki_elf_greg_t vki_elf_gregset_t[sizeof(struct vki_user_regs_struct ) / sizeof(vki_elf_greg_t )];   1582 typedef vki_elf_greg_t vki_elf_gregset_t[sizeof(struct vki_user_regs_struct ) / sizeof(vki_elf_greg_t )];
1583 typedef struct vki_user_i387_struct vki_elf_fpregset_t;   1583 typedef struct vki_user_i387_struct vki_elf_fpregset_t;
1584 typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;   1584 typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
1585 struct vki_ucontext {   1585 struct vki_ucontext {
1586    unsigned long uc_flags ;   1586    unsigned long uc_flags ;
1587    struct vki_ucontext *uc_link ;   1587    struct vki_ucontext *uc_link ;
1588    vki_stack_t uc_stack ;   1588    vki_stack_t uc_stack ;
1589    struct vki_sigcontext uc_mcontext ;   1589    struct vki_sigcontext uc_mcontext ;
1590    vki_sigset_t uc_sigmask ;   1590    vki_sigset_t uc_sigmask ;
1591 };   1591 };
1592 struct vki_user_desc {   1592 struct vki_user_desc {
1593    unsigned int entry_number ;   1593    unsigned int entry_number ;
1594    unsigned long base_addr ;   1594    unsigned long base_addr ;
1595    unsigned int limit ;   1595    unsigned int limit ;
1596    unsigned int seg_32bit : 1 ;   1596    unsigned int seg_32bit : 1 ;
1597    unsigned int contents : 2 ;   1597    unsigned int contents : 2 ;
1598    unsigned int read_exec_only : 1 ;   1598    unsigned int read_exec_only : 1 ;
1599    unsigned int limit_in_pages : 1 ;   1599    unsigned int limit_in_pages : 1 ;
1600    unsigned int seg_not_present : 1 ;   1600    unsigned int seg_not_present : 1 ;
1601    unsigned int useable : 1 ;   1601    unsigned int useable : 1 ;
1602    unsigned int reserved : 25 ;   1602    unsigned int reserved : 25 ;
1603 };   1603 };
1604 typedef struct vki_user_desc vki_modify_ldt_t;   1604 typedef struct vki_user_desc vki_modify_ldt_t;
1605 struct vki_ipc64_perm {   1605 struct vki_ipc64_perm {
1606    __vki_kernel_key_t key ;   1606    __vki_kernel_key_t key ;
1607    __vki_kernel_uid32_t uid ;   1607    __vki_kernel_uid32_t uid ;
1608    __vki_kernel_gid32_t gid ;   1608    __vki_kernel_gid32_t gid ;
1609    __vki_kernel_uid32_t cuid ;   1609    __vki_kernel_uid32_t cuid ;
1610    __vki_kernel_gid32_t cgid ;   1610    __vki_kernel_gid32_t cgid ;
1611    __vki_kernel_mode_t mode ;   1611    __vki_kernel_mode_t mode ;
1612    unsigned short __pad1 ;   1612    unsigned short __pad1 ;
1613    unsigned short seq ;   1613    unsigned short seq ;
1614    unsigned short __pad2 ;   1614    unsigned short __pad2 ;
1615    unsigned long __unused1 ;   1615    unsigned long __unused1 ;
1616    unsigned long __unused2 ;   1616    unsigned long __unused2 ;
1617 };   1617 };
1618 struct vki_semid64_ds {   1618 struct vki_semid64_ds {
1619    struct vki_ipc64_perm sem_perm ;   1619    struct vki_ipc64_perm sem_perm ;
1620    __vki_kernel_time_t sem_otime ;   1620    __vki_kernel_time_t sem_otime ;
1621    unsigned long __unused1 ;   1621    unsigned long __unused1 ;
1622    __vki_kernel_time_t sem_ctime ;   1622    __vki_kernel_time_t sem_ctime ;
1623    unsigned long __unused2 ;   1623    unsigned long __unused2 ;
1624    unsigned long sem_nsems ;   1624    unsigned long sem_nsems ;
1625    unsigned long __unused3 ;   1625    unsigned long __unused3 ;
1626    unsigned long __unused4 ;   1626    unsigned long __unused4 ;
1627 };   1627 };
1628 struct vki_msqid64_ds {   1628 struct vki_msqid64_ds {
1629    struct vki_ipc64_perm msg_perm ;   1629    struct vki_ipc64_perm msg_perm ;
1630    __vki_kernel_time_t msg_stime ;   1630    __vki_kernel_time_t msg_stime ;
1631    unsigned long __unused1 ;   1631    unsigned long __unused1 ;
1632    __vki_kernel_time_t msg_rtime ;   1632    __vki_kernel_time_t msg_rtime ;
1633    unsigned long __unused2 ;   1633    unsigned long __unused2 ;
1634    __vki_kernel_time_t msg_ctime ;   1634    __vki_kernel_time_t msg_ctime ;
1635    unsigned long __unused3 ;   1635    unsigned long __unused3 ;
1636    unsigned long msg_cbytes ;   1636    unsigned long msg_cbytes ;
1637    unsigned long msg_qnum ;   1637    unsigned long msg_qnum ;
1638    unsigned long msg_qbytes ;   1638    unsigned long msg_qbytes ;
1639    __vki_kernel_pid_t msg_lspid ;   1639    __vki_kernel_pid_t msg_lspid ;
1640    __vki_kernel_pid_t msg_lrpid ;   1640    __vki_kernel_pid_t msg_lrpid ;
1641    unsigned long __unused4 ;   1641    unsigned long __unused4 ;
1642    unsigned long __unused5 ;   1642    unsigned long __unused5 ;
1643 };   1643 };
1644 struct vki_msgbuf;   1644 struct vki_msgbuf;
1645 struct vki_ipc_kludge {   1645 struct vki_ipc_kludge {
1646    struct vki_msgbuf *msgp ;   1646    struct vki_msgbuf *msgp ;
1647    long msgtyp ;   1647    long msgtyp ;
1648 };   1648 };
1649 struct vki_shmid64_ds {   1649 struct vki_shmid64_ds {
1650    struct vki_ipc64_perm shm_perm ;   1650    struct vki_ipc64_perm shm_perm ;
1651    vki_size_t shm_segsz ;   1651    vki_size_t shm_segsz ;
1652    __vki_kernel_time_t shm_atime ;   1652    __vki_kernel_time_t shm_atime ;
1653    unsigned long __unused1 ;   1653    unsigned long __unused1 ;
1654    __vki_kernel_time_t shm_dtime ;   1654    __vki_kernel_time_t shm_dtime ;
1655    unsigned long __unused2 ;   1655    unsigned long __unused2 ;
1656    __vki_kernel_time_t shm_ctime ;   1656    __vki_kernel_time_t shm_ctime ;
1657    unsigned long __unused3 ;   1657    unsigned long __unused3 ;
1658    __vki_kernel_pid_t shm_cpid ;   1658    __vki_kernel_pid_t shm_cpid ;
1659    __vki_kernel_pid_t shm_lpid ;   1659    __vki_kernel_pid_t shm_lpid ;
1660    unsigned long shm_nattch ;   1660    unsigned long shm_nattch ;
1661    unsigned long __unused4 ;   1661    unsigned long __unused4 ;
1662    unsigned long __unused5 ;   1662    unsigned long __unused5 ;
1663 };   1663 };
1664 struct vki_shminfo64 {   1664 struct vki_shminfo64 {
1665    unsigned long shmmax ;   1665    unsigned long shmmax ;
1666    unsigned long shmmin ;   1666    unsigned long shmmin ;
1667    unsigned long shmmni ;   1667    unsigned long shmmni ;
1668    unsigned long shmseg ;   1668    unsigned long shmseg ;
1669    unsigned long shmall ;   1669    unsigned long shmall ;
1670    unsigned long __unused1 ;   1670    unsigned long __unused1 ;
1671    unsigned long __unused2 ;   1671    unsigned long __unused2 ;
1672    unsigned long __unused3 ;   1672    unsigned long __unused3 ;
1673    unsigned long __unused4 ;   1673    unsigned long __unused4 ;
1674 };   1674 };
1675 struct vki_vm86_regs {   1675 struct vki_vm86_regs {
1676    long ebx ;   1676    long ebx ;
1677    long ecx ;   1677    long ecx ;
1678    long edx ;   1678    long edx ;
1679    long esi ;   1679    long esi ;
1680    long edi ;   1680    long edi ;
1681    long ebp ;   1681    long ebp ;
1682    long eax ;   1682    long eax ;
1683    long __null_ds ;   1683    long __null_ds ;
1684    long __null_es ;   1684    long __null_es ;
1685    long __null_fs ;   1685    long __null_fs ;
1686    long __null_gs ;   1686    long __null_gs ;
1687    long orig_eax ;   1687    long orig_eax ;
1688    long eip ;   1688    long eip ;
1689    unsigned short cs ;   1689    unsigned short cs ;
1690    unsigned short __csh ;   1690    unsigned short __csh ;
1691    long eflags ;   1691    long eflags ;
1692    long esp ;   1692    long esp ;
1693    unsigned short ss ;   1693    unsigned short ss ;
1694    unsigned short __ssh ;   1694    unsigned short __ssh ;
1695    unsigned short es ;   1695    unsigned short es ;
1696    unsigned short __esh ;   1696    unsigned short __esh ;
1697    unsigned short ds ;   1697    unsigned short ds ;
1698    unsigned short __dsh ;   1698    unsigned short __dsh ;
1699    unsigned short fs ;   1699    unsigned short fs ;
1700    unsigned short __fsh ;   1700    unsigned short __fsh ;
1701    unsigned short gs ;   1701    unsigned short gs ;
1702    unsigned short __gsh ;   1702    unsigned short __gsh ;
1703 };   1703 };
1704 struct vki_revectored_struct {   1704 struct vki_revectored_struct {
1705    unsigned long __map[8] ;   1705    unsigned long __map[8] ;
1706 };   1706 };
1707 struct vki_vm86_struct {   1707 struct vki_vm86_struct {
1708    struct vki_vm86_regs regs ;   1708    struct vki_vm86_regs regs ;
1709    unsigned long flags ;   1709    unsigned long flags ;
1710    unsigned long screen_bitmap ;   1710    unsigned long screen_bitmap ;
1711    unsigned long cpu_type ;   1711    unsigned long cpu_type ;
1712    struct vki_revectored_struct int_revectored ;   1712    struct vki_revectored_struct int_revectored ;
1713    struct vki_revectored_struct int21_revectored ;   1713    struct vki_revectored_struct int21_revectored ;
1714 };   1714 };
1715 struct vki_vm86plus_info_struct {   1715 struct vki_vm86plus_info_struct {
1716    unsigned long force_return_for_pic : 1 ;   1716    unsigned long force_return_for_pic : 1 ;
1717    unsigned long vm86dbg_active : 1 ;   1717    unsigned long vm86dbg_active : 1 ;
1718    unsigned long vm86dbg_TFpendig : 1 ;   1718    unsigned long vm86dbg_TFpendig : 1 ;
1719    unsigned long unused : 28 ;   1719    unsigned long unused : 28 ;
1720    unsigned long is_vm86pus : 1 ;   1720    unsigned long is_vm86pus : 1 ;
1721    unsigned char vm86dbg_intxxtab[32] ;   1721    unsigned char vm86dbg_intxxtab[32] ;
1722 };   1722 };
1723 struct vki_vm86plus_struct {   1723 struct vki_vm86plus_struct {
1724    struct vki_vm86_regs regs ;   1724    struct vki_vm86_regs regs ;
1725    unsigned long flags ;   1725    unsigned long flags ;
1726    unsigned long screen_bitmap ;   1726    unsigned long screen_bitmap ;
1727    unsigned long cpu_type ;   1727    unsigned long cpu_type ;
1728    struct vki_revectored_struct int_revectored ;   1728    struct vki_revectored_struct int_revectored ;
1729    struct vki_revectored_struct int21_revectored ;   1729    struct vki_revectored_struct int21_revectored ;
1730    struct vki_vm86plus_info_struct vm86plus ;   1730    struct vki_vm86plus_info_struct vm86plus ;
1731 };   1731 };
1732 typedef __vki_s32 vki_int32_t;   1732 typedef __vki_s32 vki_int32_t;
1733 typedef __vki_u8 vki_uint8_t;   1733 typedef __vki_u8 vki_uint8_t;
1734 typedef __vki_u16 vki_uint16_t;   1734 typedef __vki_u16 vki_uint16_t;
1735 typedef __vki_u32 vki_uint32_t;   1735 typedef __vki_u32 vki_uint32_t;
1736 struct vki_sysinfo {   1736 struct vki_sysinfo {
1737    long uptime ;   1737    long uptime ;
1738    unsigned long loads[3] ;   1738    unsigned long loads[3] ;
1739    unsigned long totalram ;   1739    unsigned long totalram ;
1740    unsigned long freeram ;   1740    unsigned long freeram ;
1741    unsigned long sharedram ;   1741    unsigned long sharedram ;
1742    unsigned long bufferram ;   1742    unsigned long bufferram ;
1743    unsigned long totalswap ;   1743    unsigned long totalswap ;
1744    unsigned long freeswap ;   1744    unsigned long freeswap ;
1745    unsigned short procs ;   1745    unsigned short procs ;
1746    unsigned short pad ;   1746    unsigned short pad ;
1747    unsigned long totalhigh ;   1747    unsigned long totalhigh ;
1748    unsigned long freehigh ;   1748    unsigned long freehigh ;
1749    unsigned int mem_unit ;   1749    unsigned int mem_unit ;
1750    char _f[(20U - 2U * sizeof(long )) - sizeof(int )] ;   1750    char _f[(20U - 2U * sizeof(long )) - sizeof(int )] ;
1751 };   1751 };
1752 struct vki_timespec {   1752 struct vki_timespec {
1753    vki_time_t tv_sec ;   1753    vki_time_t tv_sec ;
1754    long tv_nsec ;   1754    long tv_nsec ;
1755 };   1755 };
1756 struct vki_timeval {   1756 struct vki_timeval {
1757    vki_time_t tv_sec ;   1757    vki_time_t tv_sec ;
1758    vki_suseconds_t tv_usec ;   1758    vki_suseconds_t tv_usec ;
1759 };   1759 };
1760 struct vki_timezone {   1760 struct vki_timezone {
1761    int tz_minuteswest ;   1761    int tz_minuteswest ;
1762    int tz_dsttime ;   1762    int tz_dsttime ;
1763 };   1763 };
1764 struct vki_itimerspec {   1764 struct vki_itimerspec {
1765    struct vki_timespec it_interval ;   1765    struct vki_timespec it_interval ;
1766    struct vki_timespec it_value ;   1766    struct vki_timespec it_value ;
1767 };   1767 };
1768 struct vki_itimerval {   1768 struct vki_itimerval {
1769    struct vki_timeval it_interval ;   1769    struct vki_timeval it_interval ;
1770    struct vki_timeval it_value ;   1770    struct vki_timeval it_value ;
1771 };   1771 };
1772 struct vki_timex {   1772 struct vki_timex {
1773    unsigned int modes ;   1773    unsigned int modes ;
1774    long offset ;   1774    long offset ;
1775    long freq ;   1775    long freq ;
1776    long maxerror ;   1776    long maxerror ;
1777    long esterror ;   1777    long esterror ;
1778    int status ;   1778    int status ;
1779    long constant ;   1779    long constant ;
1780    long precision ;   1780    long precision ;
1781    long tolerance ;   1781    long tolerance ;
1782    struct vki_timeval time ;   1782    struct vki_timeval time ;
1783    long tick ;   1783    long tick ;
1784    long ppsfreq ;   1784    long ppsfreq ;
1785    long jitter ;   1785    long jitter ;
1786    int shift ;   1786    int shift ;
1787    long stabil ;   1787    long stabil ;
1788    long jitcnt ;   1788    long jitcnt ;
1789    long calcnt ;   1789    long calcnt ;
1790    long errcnt ;   1790    long errcnt ;
1791    long stbcnt ;   1791    long stbcnt ;
1792    int  : 32 ;   1792    int  : 32 ;
1793    int  : 32 ;   1793    int  : 32 ;
1794    int  : 32 ;   1794    int  : 32 ;
1795    int  : 32 ;   1795    int  : 32 ;
1796    int  : 32 ;   1796    int  : 32 ;
1797    int  : 32 ;   1797    int  : 32 ;
1798    int  : 32 ;   1798    int  : 32 ;
1799    int  : 32 ;   1799    int  : 32 ;
1800    int  : 32 ;   1800    int  : 32 ;
1801    int  : 32 ;   1801    int  : 32 ;
1802    int  : 32 ;   1802    int  : 32 ;
1803    int  : 32 ;   1803    int  : 32 ;
1804 };   1804 };
1805 struct vki_tms {   1805 struct vki_tms {
1806    vki_clock_t tms_utime ;   1806    vki_clock_t tms_utime ;
1807    vki_clock_t tms_stime ;   1807    vki_clock_t tms_stime ;
1808    vki_clock_t tms_cutime ;   1808    vki_clock_t tms_cutime ;
1809    vki_clock_t tms_cstime ;   1809    vki_clock_t tms_cstime ;
1810 };   1810 };
1811 struct vki_utimbuf {   1811 struct vki_utimbuf {
1812    vki_time_t actime ;   1812    vki_time_t actime ;
1813    vki_time_t modtime ;   1813    vki_time_t modtime ;
1814 };   1814 };
1815 struct vki_sched_param {   1815 struct vki_sched_param {
1816    int sched_priority ;   1816    int sched_priority ;
1817 };   1817 };
1818 union vki_sigval {   1818 union vki_sigval {
1819    int sival_int ;   1819    int sival_int ;
1820    void *sival_ptr ;   1820    void *sival_ptr ;
1821 };   1821 };
1822 typedef union vki_sigval vki_sigval_t;   1822 typedef union vki_sigval vki_sigval_t;
1823 struct __anonstruct__kill_70 {   1823 struct __anonstruct__kill_70 {
1824    vki_pid_t _pid ;   1824    vki_pid_t _pid ;
1825    vki_uid_t _uid ;   1825    vki_uid_t _uid ;
1826 };   1826 };
1827 struct __anonstruct__timer_71 {   1827 struct __anonstruct__timer_71 {
1828    vki_timer_t _tid ;   1828    vki_timer_t _tid ;
1829    int _overrun ;   1829    int _overrun ;
1830    char _pad[sizeof(vki_uid_t ) - sizeof(int )] ;   1830    char _pad[sizeof(vki_uid_t ) - sizeof(int )] ;
1831    vki_sigval_t _sigval ;   1831    vki_sigval_t _sigval ;
1832    int _sys_private ;   1832    int _sys_private ;
1833 };   1833 };
1834 struct __anonstruct__rt_72 {   1834 struct __anonstruct__rt_72 {
1835    vki_pid_t _pid ;   1835    vki_pid_t _pid ;
1836    vki_uid_t _uid ;   1836    vki_uid_t _uid ;
1837    vki_sigval_t _sigval ;   1837    vki_sigval_t _sigval ;
1838 };   1838 };
1839 struct __anonstruct__sigchld_73 {   1839 struct __anonstruct__sigchld_73 {
1840    vki_pid_t _pid ;   1840    vki_pid_t _pid ;
1841    vki_uid_t _uid ;   1841    vki_uid_t _uid ;
1842    int _status ;   1842    int _status ;
1843    vki_clock_t _utime ;   1843    vki_clock_t _utime ;
1844    vki_clock_t _stime ;   1844    vki_clock_t _stime ;
1845 };   1845 };
1846 struct __anonstruct__sigfault_74 {   1846 struct __anonstruct__sigfault_74 {
1847    void *_addr ;   1847    void *_addr ;
1848 };   1848 };
1849 struct __anonstruct__sigpoll_75 {   1849 struct __anonstruct__sigpoll_75 {
1850    long _band ;   1850    long _band ;
1851    int _fd ;   1851    int _fd ;
1852 };   1852 };
1853 union __anonunion__sifields_69 {   1853 union __anonunion__sifields_69 {
1854    int _pad[(128U - 3U * sizeof(int )) / sizeof(int )] ;   1854    int _pad[(128U - 3U * sizeof(int )) / sizeof(int )] ;
1855    struct __anonstruct__kill_70 _kill ;   1855    struct __anonstruct__kill_70 _kill ;
1856    struct __anonstruct__timer_71 _timer ;   1856    struct __anonstruct__timer_71 _timer ;
1857    struct __anonstruct__rt_72 _rt ;   1857    struct __anonstruct__rt_72 _rt ;
1858    struct __anonstruct__sigchld_73 _sigchld ;   1858    struct __anonstruct__sigchld_73 _sigchld ;
1859    struct __anonstruct__sigfault_74 _sigfault ;   1859    struct __anonstruct__sigfault_74 _sigfault ;
1860    struct __anonstruct__sigpoll_75 _sigpoll ;   1860    struct __anonstruct__sigpoll_75 _sigpoll ;
1861 };   1861 };
1862 struct vki_siginfo {   1862 struct vki_siginfo {
1863    int si_signo ;   1863    int si_signo ;
1864    int si_errno ;   1864    int si_errno ;
1865    int si_code ;   1865    int si_code ;
1866    union __anonunion__sifields_69 _sifields ;   1866    union __anonunion__sifields_69 _sifields ;
1867 };   1867 };
1868 typedef struct vki_siginfo vki_siginfo_t;   1868 typedef struct vki_siginfo vki_siginfo_t;
1869 struct __anonstruct__sigev_thread_77 {   1869 struct __anonstruct__sigev_thread_77 {
1870    void (*_function)(vki_sigval_t  ) ;   1870    void (*_function)(vki_sigval_t  ) ;
1871    void *_attribute ;   1871    void *_attribute ;
1872 };   1872 };
1873 union __anonunion__sigev_un_76 {   1873 union __anonunion__sigev_un_76 {
1874    int _pad[(64U - (sizeof(int ) * 2U + sizeof(vki_sigval_t ))) / sizeof(int )] ;   1874    int _pad[(64U - (sizeof(int ) * 2U + sizeof(vki_sigval_t ))) / sizeof(int )] ;
1875    int _tid ;   1875    int _tid ;
1876    struct __anonstruct__sigev_thread_77 _sigev_thread ;   1876    struct __anonstruct__sigev_thread_77 _sigev_thread ;
1877 };   1877 };
1878 struct vki_sigevent {   1878 struct vki_sigevent {
1879    vki_sigval_t sigev_value ;   1879    vki_sigval_t sigev_value ;
1880    int sigev_signo ;   1880    int sigev_signo ;
1881    int sigev_notify ;   1881    int sigev_notify ;
1882    union __anonunion__sigev_un_76 _sigev_un ;   1882    union __anonunion__sigev_un_76 _sigev_un ;
1883 };   1883 };
1884 typedef struct vki_sigevent vki_sigevent_t;   1884 typedef struct vki_sigevent vki_sigevent_t;
1885 enum vki_sock_type {   1885 enum vki_sock_type {
1886     VKI_SOCK_STREAM = 1   1886     VKI_SOCK_STREAM = 1
1887 } ;   1887 } ;
1888 struct vki_iovec {   1888 struct vki_iovec {
1889    void *iov_base ;   1889    void *iov_base ;
1890    __vki_kernel_size_t iov_len ;   1890    __vki_kernel_size_t iov_len ;
1891 };   1891 };
1892 typedef unsigned short vki_sa_family_t;   1892 typedef unsigned short vki_sa_family_t;
1893 struct vki_sockaddr {   1893 struct vki_sockaddr {
1894    vki_sa_family_t sa_family ;   1894    vki_sa_family_t sa_family ;
1895    char sa_data[14] ;   1895    char sa_data[14] ;
1896 };   1896 };
1897 struct vki_msghdr {   1897 struct vki_msghdr {
1898    void *msg_name ;   1898    void *msg_name ;
1899    int msg_namelen ;   1899    int msg_namelen ;
1900    struct vki_iovec *msg_iov ;   1900    struct vki_iovec *msg_iov ;
1901    __vki_kernel_size_t msg_iovlen ;   1901    __vki_kernel_size_t msg_iovlen ;
1902    void *msg_control ;   1902    void *msg_control ;
1903    __vki_kernel_size_t msg_controllen ;   1903    __vki_kernel_size_t msg_controllen ;
1904    unsigned int msg_flags ;   1904    unsigned int msg_flags ;
1905 };   1905 };
1906 struct vki_cmsghdr {   1906 struct vki_cmsghdr {
1907    __vki_kernel_size_t cmsg_len ;   1907    __vki_kernel_size_t cmsg_len ;
1908    int cmsg_level ;   1908    int cmsg_level ;
1909    int cmsg_type ;   1909    int cmsg_type ;
1910 };   1910 };
1911 struct vki_in_addr {   1911 struct vki_in_addr {
1912    __vki_u32 s_addr ;   1912    __vki_u32 s_addr ;
1913 };   1913 };
1914 struct vki_sockaddr_in {   1914 struct vki_sockaddr_in {
1915    vki_sa_family_t sin_family ;   1915    vki_sa_family_t sin_family ;
1916    unsigned short sin_port ;   1916    unsigned short sin_port ;
1917    struct vki_in_addr sin_addr ;   1917    struct vki_in_addr sin_addr ;
1918    unsigned char __pad[((16U - sizeof(short )) - sizeof(unsigned short )) - sizeof(struct vki_in_addr )] ;   1918    unsigned char __pad[((16U - sizeof(short )) - sizeof(unsigned short )) - sizeof(struct vki_in_addr )] ;
1919 };   1919 };
1920 union __anonunion_vki_in6_u_78 {   1920 union __anonunion_vki_in6_u_78 {
1921    __vki_u8 u6_addr8[16] ;   1921    __vki_u8 u6_addr8[16] ;
1922    __vki_u16 u6_addr16[8] ;   1922    __vki_u16 u6_addr16[8] ;
1923    __vki_u32 u6_addr32[4] ;   1923    __vki_u32 u6_addr32[4] ;
1924 };   1924 };
1925 struct vki_in6_addr {   1925 struct vki_in6_addr {
1926    union __anonunion_vki_in6_u_78 vki_in6_u ;   1926    union __anonunion_vki_in6_u_78 vki_in6_u ;
1927 };   1927 };
1928 struct vki_sockaddr_in6 {   1928 struct vki_sockaddr_in6 {
1929    unsigned short sin6_family ;   1929    unsigned short sin6_family ;
1930    __vki_u16 sin6_port ;   1930    __vki_u16 sin6_port ;
1931    __vki_u32 sin6_flowinfo ;   1931    __vki_u32 sin6_flowinfo ;
1932    struct vki_in6_addr sin6_addr ;   1932    struct vki_in6_addr sin6_addr ;
1933    __vki_u32 sin6_scope_id ;   1933    __vki_u32 sin6_scope_id ;
1934 };   1934 };
1935 struct vki_sockaddr_un {   1935 struct vki_sockaddr_un {
1936    vki_sa_family_t sun_family ;   1936    vki_sa_family_t sun_family ;
1937    char sun_path[108] ;   1937    char sun_path[108] ;
1938 };   1938 };
1939 struct vki_ifmap {   1939 struct vki_ifmap {
1940    unsigned long mem_start ;   1940    unsigned long mem_start ;
1941    unsigned long mem_end ;   1941    unsigned long mem_end ;
1942    unsigned short base_addr ;   1942    unsigned short base_addr ;
1943    unsigned char irq ;   1943    unsigned char irq ;
1944    unsigned char dma ;   1944    unsigned char dma ;
1945    unsigned char port ;   1945    unsigned char port ;
1946 };   1946 };
1947 union __anonunion_ifs_ifsu_79 {   1947 union __anonunion_ifs_ifsu_79 {
1948    void *raw_hdlc ;   1948    void *raw_hdlc ;
1949    void *cisco ;   1949    void *cisco ;
1950    void *fr ;   1950    void *fr ;
1951    void *fr_pvc ;   1951    void *fr_pvc ;
1952    void *fr_pvc_info ;   1952    void *fr_pvc_info ;
1953    void *sync ;   1953    void *sync ;
1954    void *te1 ;   1954    void *te1 ;
1955 };   1955 };
1956 struct vki_if_settings {   1956 struct vki_if_settings {
1957    unsigned int type ;   1957    unsigned int type ;
1958    unsigned int size ;   1958    unsigned int size ;
1959    union __anonunion_ifs_ifsu_79 ifs_ifsu ;   1959    union __anonunion_ifs_ifsu_79 ifs_ifsu ;
1960 };   1960 };
1961 union __anonunion_ifr_ifrn_80 {   1961 union __anonunion_ifr_ifrn_80 {
1962    char ifrn_name[16] ;   1962    char ifrn_name[16] ;
1963 };   1963 };
1964 union __anonunion_ifr_ifru_81 {   1964 union __anonunion_ifr_ifru_81 {
1965    struct vki_sockaddr ifru_addr ;   1965    struct vki_sockaddr ifru_addr ;
1966    struct vki_sockaddr ifru_dstaddr ;   1966    struct vki_sockaddr ifru_dstaddr ;
1967    struct vki_sockaddr ifru_broadaddr ;   1967    struct vki_sockaddr ifru_broadaddr ;
1968    struct vki_sockaddr ifru_netmask ;   1968    struct vki_sockaddr ifru_netmask ;
1969    struct vki_sockaddr ifru_hwaddr ;   1969    struct vki_sockaddr ifru_hwaddr ;
1970    short ifru_flags ;   1970    short ifru_flags ;
1971    int ifru_ivalue ;   1971    int ifru_ivalue ;
1972    int ifru_mtu ;   1972    int ifru_mtu ;
1973    struct vki_ifmap ifru_map ;   1973    struct vki_ifmap ifru_map ;
1974    char ifru_slave[16] ;   1974    char ifru_slave[16] ;
1975    char ifru_newname[16] ;   1975    char ifru_newname[16] ;
1976    void *ifru_data ;   1976    void *ifru_data ;
1977    struct vki_if_settings ifru_settings ;   1977    struct vki_if_settings ifru_settings ;
1978 };   1978 };
1979 struct vki_ifreq {   1979 struct vki_ifreq {
1980    union __anonunion_ifr_ifrn_80 ifr_ifrn ;   1980    union __anonunion_ifr_ifrn_80 ifr_ifrn ;
1981    union __anonunion_ifr_ifru_81 ifr_ifru ;   1981    union __anonunion_ifr_ifru_81 ifr_ifru ;
1982 };   1982 };
1983 union __anonunion_ifc_ifcu_82 {   1983 union __anonunion_ifc_ifcu_82 {
1984    char *ifcu_buf ;   1984    char *ifcu_buf ;
1985    struct vki_ifreq *ifcu_req ;   1985    struct vki_ifreq *ifcu_req ;
1986 };   1986 };
1987 struct vki_ifconf {   1987 struct vki_ifconf {
1988    int ifc_len ;   1988    int ifc_len ;
1989    union __anonunion_ifc_ifcu_82 ifc_ifcu ;   1989    union __anonunion_ifc_ifcu_82 ifc_ifcu ;
1990 };   1990 };
1991 struct vki_arpreq {   1991 struct vki_arpreq {
1992    struct vki_sockaddr arp_pa ;   1992    struct vki_sockaddr arp_pa ;
1993    struct vki_sockaddr arp_ha ;   1993    struct vki_sockaddr arp_ha ;
1994    int arp_flags ;   1994    int arp_flags ;
1995    struct vki_sockaddr arp_netmask ;   1995    struct vki_sockaddr arp_netmask ;
1996    char arp_dev[16] ;   1996    char arp_dev[16] ;
1997 };   1997 };
1998 struct vki_rtentry {   1998 struct vki_rtentry {
1999    unsigned long rt_pad1 ;   1999    unsigned long rt_pad1 ;
2000    struct vki_sockaddr rt_dst ;   2000    struct vki_sockaddr rt_dst ;
2001    struct vki_sockaddr rt_gateway ;   2001    struct vki_sockaddr rt_gateway ;
2002    struct vki_sockaddr rt_genmask ;   2002    struct vki_sockaddr rt_genmask ;
2003    unsigned short rt_flags ;   2003    unsigned short rt_flags ;
2004    short rt_pad2 ;   2004    short rt_pad2 ;
2005    unsigned long rt_pad3 ;   2005    unsigned long rt_pad3 ;
2006    void *rt_pad4 ;   2006    void *rt_pad4 ;
2007    short rt_metric ;   2007    short rt_metric ;
2008    char *rt_dev ;   2008    char *rt_dev ;
2009    unsigned long rt_mtu ;   2009    unsigned long rt_mtu ;
2010    unsigned long rt_window ;   2010    unsigned long rt_window ;
2011    unsigned short rt_irtt ;   2011    unsigned short rt_irtt ;
2012 };   2012 };
2013 typedef __vki_s32 vki_sctp_assoc_t;   2013 typedef __vki_s32 vki_sctp_assoc_t;
2014 enum vki_sctp_optname {   2014 enum vki_sctp_optname {
2015     VKI_SCTP_RTOINFO = 0,   2015     VKI_SCTP_RTOINFO = 0,
2016     VKI_SCTP_ASSOCINFO = 1,   2016     VKI_SCTP_ASSOCINFO = 1,
2017     VKI_SCTP_INITMSG = 2,   2017     VKI_SCTP_INITMSG = 2,
2018     VKI_SCTP_NODELAY = 3,   2018     VKI_SCTP_NODELAY = 3,
2019     VKI_SCTP_AUTOCLOSE = 4,   2019     VKI_SCTP_AUTOCLOSE = 4,
2020     VKI_SCTP_SET_PEER_PRIMARY_ADDR = 5,   2020     VKI_SCTP_SET_PEER_PRIMARY_ADDR = 5,
2021     VKI_SCTP_PRIMARY_ADDR = 6,   2021     VKI_SCTP_PRIMARY_ADDR = 6,
2022     VKI_SCTP_ADAPTION_LAYER = 7,   2022     VKI_SCTP_ADAPTION_LAYER = 7,
2023     VKI_SCTP_DISABLE_FRAGMENTS = 8,   2023     VKI_SCTP_DISABLE_FRAGMENTS = 8,
2024     VKI_SCTP_PEER_ADDR_PARAMS = 9,   2024     VKI_SCTP_PEER_ADDR_PARAMS = 9,
2025     VKI_SCTP_DEFAULT_SEND_PARAM = 10,   2025     VKI_SCTP_DEFAULT_SEND_PARAM = 10,
2026     VKI_SCTP_EVENTS = 11,   2026     VKI_SCTP_EVENTS = 11,
2027     VKI_SCTP_I_WANT_MAPPED_V4_ADDR = 12,   2027     VKI_SCTP_I_WANT_MAPPED_V4_ADDR = 12,
2028     VKI_SCTP_MAXSEG = 13,   2028     VKI_SCTP_MAXSEG = 13,
2029     VKI_SCTP_STATUS = 14,   2029     VKI_SCTP_STATUS = 14,
2030     VKI_SCTP_GET_PEER_ADDR_INFO = 15,   2030     VKI_SCTP_GET_PEER_ADDR_INFO = 15,
2031     VKI_SCTP_SOCKOPT_BINDX_ADD = 100,   2031     VKI_SCTP_SOCKOPT_BINDX_ADD = 100,
2032     VKI_SCTP_SOCKOPT_BINDX_REM = 101,   2032     VKI_SCTP_SOCKOPT_BINDX_REM = 101,
2033     VKI_SCTP_SOCKOPT_PEELOFF = 102,   2033     VKI_SCTP_SOCKOPT_PEELOFF = 102,
2034     VKI_SCTP_GET_PEER_ADDRS_NUM = 103,   2034     VKI_SCTP_GET_PEER_ADDRS_NUM = 103,
2035     VKI_SCTP_GET_PEER_ADDRS = 104,   2035     VKI_SCTP_GET_PEER_ADDRS = 104,
2036     VKI_SCTP_GET_LOCAL_ADDRS_NUM = 105,   2036     VKI_SCTP_GET_LOCAL_ADDRS_NUM = 105,
2037     VKI_SCTP_GET_LOCAL_ADDRS = 106,   2037     VKI_SCTP_GET_LOCAL_ADDRS = 106,
2038     VKI_SCTP_SOCKOPT_CONNECTX = 107   2038     VKI_SCTP_SOCKOPT_CONNECTX = 107
2039 } ;   2039 } ;
2040 struct vki_sctp_getaddrs {   2040 struct vki_sctp_getaddrs {
2041    vki_sctp_assoc_t assoc_id ;   2041    vki_sctp_assoc_t assoc_id ;
2042    int addr_num ;   2042    int addr_num ;
2043    struct vki_sockaddr *addrs ;   2043    struct vki_sockaddr *addrs ;
2044 };   2044 };
2045 struct vki_rusage {   2045 struct vki_rusage {
2046    struct vki_timeval ru_utime ;   2046    struct vki_timeval ru_utime ;
2047    struct vki_timeval ru_stime ;   2047    struct vki_timeval ru_stime ;
2048    long ru_maxrss ;   2048    long ru_maxrss ;
2049    long ru_ixrss ;   2049    long ru_ixrss ;
2050    long ru_idrss ;   2050    long ru_idrss ;
2051    long ru_isrss ;   2051    long ru_isrss ;
2052    long ru_minflt ;   2052    long ru_minflt ;
2053    long ru_majflt ;   2053    long ru_majflt ;
2054    long ru_nswap ;   2054    long ru_nswap ;
2055    long ru_inblock ;   2055    long ru_inblock ;
2056    long ru_oublock ;   2056    long ru_oublock ;
2057    long ru_msgsnd ;   2057    long ru_msgsnd ;
2058    long ru_msgrcv ;   2058    long ru_msgrcv ;
2059    long ru_nsignals ;   2059    long ru_nsignals ;
2060    long ru_nvcsw ;   2060    long ru_nvcsw ;
2061    long ru_nivcsw ;   2061    long ru_nivcsw ;
2062 };   2062 };
2063 struct vki_rlimit {   2063 struct vki_rlimit {
2064    unsigned long rlim_cur ;   2064    unsigned long rlim_cur ;
2065    unsigned long rlim_max ;   2065    unsigned long rlim_max ;
2066 };   2066 };
2067 struct vki_elf_siginfo {   2067 struct vki_elf_siginfo {
2068    int si_signo ;   2068    int si_signo ;
2069    int si_code ;   2069    int si_code ;
2070    int si_errno ;   2070    int si_errno ;
2071 };   2071 };
2072 struct vki_elf_prstatus {   2072 struct vki_elf_prstatus {
2073    struct vki_elf_siginfo pr_info ;   2073    struct vki_elf_siginfo pr_info ;
2074    short pr_cursig ;   2074    short pr_cursig ;
2075    unsigned long pr_sigpend ;   2075    unsigned long pr_sigpend ;
2076    unsigned long pr_sighold ;   2076    unsigned long pr_sighold ;
2077    vki_pid_t pr_pid ;   2077    vki_pid_t pr_pid ;
2078    vki_pid_t pr_ppid ;   2078    vki_pid_t pr_ppid ;
2079    vki_pid_t pr_pgrp ;   2079    vki_pid_t pr_pgrp ;
2080    vki_pid_t pr_sid ;   2080    vki_pid_t pr_sid ;
2081    struct vki_timeval pr_utime ;   2081    struct vki_timeval pr_utime ;
2082    struct vki_timeval pr_stime ;   2082    struct vki_timeval pr_stime ;
2083    struct vki_timeval pr_cutime ;   2083    struct vki_timeval pr_cutime ;
2084    struct vki_timeval pr_cstime ;   2084    struct vki_timeval pr_cstime ;
2085    vki_elf_gregset_t pr_reg ;   2085    vki_elf_gregset_t pr_reg ;
2086    int pr_fpvalid ;   2086    int pr_fpvalid ;
2087 };   2087 };
2088 struct vki_elf_prpsinfo {   2088 struct vki_elf_prpsinfo {
2089    char pr_state ;   2089    char pr_state ;
2090    char pr_sname ;   2090    char pr_sname ;
2091    char pr_zomb ;   2091    char pr_zomb ;
2092    char pr_nice ;   2092    char pr_nice ;
2093    unsigned long pr_flag ;   2093    unsigned long pr_flag ;
2094    __vki_kernel_uid_t pr_uid ;   2094    __vki_kernel_uid_t pr_uid ;
2095    __vki_kernel_gid_t pr_gid ;   2095    __vki_kernel_gid_t pr_gid ;
2096    vki_pid_t pr_pid ;   2096    vki_pid_t pr_pid ;
2097    vki_pid_t pr_ppid ;   2097    vki_pid_t pr_ppid ;
2098    vki_pid_t pr_pgrp ;   2098    vki_pid_t pr_pgrp ;
2099    vki_pid_t pr_sid ;   2099    vki_pid_t pr_sid ;
2100    char pr_fname[16] ;   2100    char pr_fname[16] ;
2101    char pr_psargs[80] ;   2101    char pr_psargs[80] ;
2102 };   2102 };
2103 struct vki_epoll_event {   2103 struct vki_epoll_event {
2104    __vki_u32 events ;   2104    __vki_u32 events ;
2105    __vki_u64 data ;   2105    __vki_u64 data ;
2106 };   2106 };
2107 struct vki_mq_attr {   2107 struct vki_mq_attr {
2108    long mq_flags ;   2108    long mq_flags ;
2109    long mq_maxmsg ;   2109    long mq_maxmsg ;
2110    long mq_msgsize ;   2110    long mq_msgsize ;
2111    long mq_curmsgs ;   2111    long mq_curmsgs ;
2112    long __reserved[4] ;   2112    long __reserved[4] ;
2113 };   2113 };
2114 struct vki_new_utsname {   2114 struct vki_new_utsname {
2115    char sysname[65] ;   2115    char sysname[65] ;
2116    char nodename[65] ;   2116    char nodename[65] ;
2117    char release[65] ;   2117    char release[65] ;
2118    char version[65] ;   2118    char version[65] ;
2119    char machine[65] ;   2119    char machine[65] ;
2120    char domainname[65] ;   2120    char domainname[65] ;
2121 };   2121 };
2122 struct vki_mii_ioctl_data {   2122 struct vki_mii_ioctl_data {
2123    vki_u16 phy_id ;   2123    vki_u16 phy_id ;
2124    vki_u16 reg_num ;   2124    vki_u16 reg_num ;
2125    vki_u16 val_in ;   2125    vki_u16 val_in ;
2126    vki_u16 val_out ;   2126    vki_u16 val_out ;
2127 };   2127 };
2128 struct __vki_user_cap_header_struct {   2128 struct __vki_user_cap_header_struct {
2129    __vki_u32 version ;   2129    __vki_u32 version ;
2130    int pid ;   2130    int pid ;
2131 };   2131 };
2132 typedef struct __vki_user_cap_header_struct *vki_cap_user_header_t;   2132 typedef struct __vki_user_cap_header_struct *vki_cap_user_header_t;
2133 struct __vki_user_cap_data_struct {   2133 struct __vki_user_cap_data_struct {
2134    __vki_u32 effective ;   2134    __vki_u32 effective ;
2135    __vki_u32 permitted ;   2135    __vki_u32 permitted ;
2136    __vki_u32 inheritable ;   2136    __vki_u32 inheritable ;
2137 };   2137 };
2138 typedef struct __vki_user_cap_data_struct *vki_cap_user_data_t;   2138 typedef struct __vki_user_cap_data_struct *vki_cap_user_data_t;
2139 struct vki_ipc_perm {   2139 struct vki_ipc_perm {
2140    __vki_kernel_key_t key ;   2140    __vki_kernel_key_t key ;
2141    __vki_kernel_uid_t uid ;   2141    __vki_kernel_uid_t uid ;
2142    __vki_kernel_gid_t gid ;   2142    __vki_kernel_gid_t gid ;
2143    __vki_kernel_uid_t cuid ;   2143    __vki_kernel_uid_t cuid ;
2144    __vki_kernel_gid_t cgid ;   2144    __vki_kernel_gid_t cgid ;
2145    __vki_kernel_mode_t mode ;   2145    __vki_kernel_mode_t mode ;
2146    unsigned short seq ;   2146    unsigned short seq ;
2147 };   2147 };
2148 struct vki_semid_ds {   2148 struct vki_semid_ds {
2149    struct vki_ipc_perm sem_perm ;   2149    struct vki_ipc_perm sem_perm ;
2150    __vki_kernel_time_t sem_otime ;   2150    __vki_kernel_time_t sem_otime ;
2151    __vki_kernel_time_t sem_ctime ;   2151    __vki_kernel_time_t sem_ctime ;
2152    void *sem_base ;   2152    void *sem_base ;
2153    void *sem_pending ;   2153    void *sem_pending ;
2154    void **sem_pending_last ;   2154    void **sem_pending_last ;
2155    void *undo ;   2155    void *undo ;
2156    unsigned short sem_nsems ;   2156    unsigned short sem_nsems ;
2157 };   2157 };
2158 struct vki_sembuf {   2158 struct vki_sembuf {
2159    unsigned short sem_num ;   2159    unsigned short sem_num ;
2160    short sem_op ;   2160    short sem_op ;
2161    short sem_flg ;   2161    short sem_flg ;
2162 };   2162 };
2163 struct vki_seminfo;   2163 struct vki_seminfo;
2164 union vki_semun {   2164 union vki_semun {
2165    int val ;   2165    int val ;
2166    struct vki_semid_ds *buf ;   2166    struct vki_semid_ds *buf ;
2167    unsigned short *array ;   2167    unsigned short *array ;
2168    struct vki_seminfo *__buf ;   2168    struct vki_seminfo *__buf ;
2169    void *__pad ;   2169    void *__pad ;
2170 };   2170 };
2171 struct vki_seminfo {   2171 struct vki_seminfo {
2172    int semmap ;   2172    int semmap ;
2173    int semmni ;   2173    int semmni ;
2174    int semmns ;   2174    int semmns ;
2175    int semmnu ;   2175    int semmnu ;
2176    int semmsl ;   2176    int semmsl ;
2177    int semopm ;   2177    int semopm ;
2178    int semume ;   2178    int semume ;
2179    int semusz ;   2179    int semusz ;
2180    int semvmx ;   2180    int semvmx ;
2181    int semaem ;   2181    int semaem ;
2182 };   2182 };
2183 struct vki_robust_list {   2183 struct vki_robust_list {
2184    struct vki_robust_list *next ;   2184    struct vki_robust_list *next ;
2185 };   2185 };
2186 struct vki_robust_list_head {   2186 struct vki_robust_list_head {
2187    struct vki_robust_list list ;   2187    struct vki_robust_list list ;
2188    long futex_offset ;   2188    long futex_offset ;
2189    struct vki_robust_list *list_op_pending ;   2189    struct vki_robust_list *list_op_pending ;
2190 };   2190 };
2191 struct vki_dirent {   2191 struct vki_dirent {
2192    long d_ino ;   2192    long d_ino ;
2193    __vki_kernel_off_t d_off ;   2193    __vki_kernel_off_t d_off ;
2194    unsigned short d_reclen ;   2194    unsigned short d_reclen ;
2195    char d_name[256] ;   2195    char d_name[256] ;
2196 };   2196 };
2197 struct __vki_sysctl_args {   2197 struct __vki_sysctl_args {
2198    int *name ;   2198    int *name ;
2199    int nlen ;   2199    int nlen ;
2200    void *oldval ;   2200    void *oldval ;
2201    vki_size_t *oldlenp ;   2201    vki_size_t *oldlenp ;
2202    void *newval ;   2202    void *newval ;
2203    vki_size_t newlen ;   2203    vki_size_t newlen ;
2204    unsigned long __unused[4] ;   2204    unsigned long __unused[4] ;
2205 };   2205 };
2206 typedef unsigned long vki_aio_context_t;   2206 typedef unsigned long vki_aio_context_t;
2207 enum __anonenum_83 {   2207 enum __anonenum_83 {
2208     VKI_IOCB_CMD_PREAD = 0,   2208     VKI_IOCB_CMD_PREAD = 0,
2209     VKI_IOCB_CMD_PWRITE = 1,   2209     VKI_IOCB_CMD_PWRITE = 1,
2210     VKI_IOCB_CMD_FSYNC = 2,   2210     VKI_IOCB_CMD_FSYNC = 2,
2211     VKI_IOCB_CMD_FDSYNC = 3,   2211     VKI_IOCB_CMD_FDSYNC = 3,
2212     VKI_IOCB_CMD_PREADV = 7,   2212     VKI_IOCB_CMD_PREADV = 7,
2213     VKI_IOCB_CMD_PWRITEV = 8   2213     VKI_IOCB_CMD_PWRITEV = 8
2214 } ;   2214 } ;
2215 struct vki_io_event {   2215 struct vki_io_event {
2216    __vki_u64 data ;   2216    __vki_u64 data ;
2217    __vki_u64 obj ;   2217    __vki_u64 obj ;
2218    __vki_s64 result ;   2218    __vki_s64 result ;
2219    __vki_s64 result2 ;   2219    __vki_s64 result2 ;
2220 };   2220 };
2221 struct vki_iocb {   2221 struct vki_iocb {
2222    __vki_u64 aio_data ;   2222    __vki_u64 aio_data ;
2223    __vki_u32 aio_key ;   2223    __vki_u32 aio_key ;
2224    __vki_u32 aio_reserved1 ;   2224    __vki_u32 aio_reserved1 ;
2225    __vki_u16 aio_lio_opcode ;   2225    __vki_u16 aio_lio_opcode ;
2226    __vki_s16 aio_reqprio ;   2226    __vki_s16 aio_reqprio ;
2227    __vki_u32 aio_fildes ;   2227    __vki_u32 aio_fildes ;
2228    __vki_u64 aio_buf ;   2228    __vki_u64 aio_buf ;
2229    __vki_u64 aio_nbytes ;   2229    __vki_u64 aio_nbytes ;
2230    __vki_s64 aio_offset ;   2230    __vki_s64 aio_offset ;
2231    __vki_u64 aio_reserved2 ;   2231    __vki_u64 aio_reserved2 ;
2232    __vki_u64 aio_reserved3 ;   2232    __vki_u64 aio_reserved3 ;
2233 };   2233 };
2234 struct vki_aio_ring {   2234 struct vki_aio_ring {
2235    unsigned int id ;   2235    unsigned int id ;
2236    unsigned int nr ;   2236    unsigned int nr ;
2237    unsigned int head ;   2237    unsigned int head ;
2238    unsigned int tail ;   2238    unsigned int tail ;
2239    unsigned int magic ;   2239    unsigned int magic ;
2240    unsigned int compat_features ;   2240    unsigned int compat_features ;
2241    unsigned int incompat_features ;   2241    unsigned int incompat_features ;
2242    unsigned int header_length ;   2242    unsigned int header_length ;
2243    struct vki_io_event io_events[0] ;   2243    struct vki_io_event io_events[0] ;
2244 };   2244 };
2245 struct vki_msg;   2245 struct vki_msg;
2246 struct vki_msqid_ds {   2246 struct vki_msqid_ds {
2247    struct vki_ipc_perm msg_perm ;   2247    struct vki_ipc_perm msg_perm ;
2248    struct vki_msg *msg_first ;   2248    struct vki_msg *msg_first ;
2249    struct vki_msg *msg_last ;   2249    struct vki_msg *msg_last ;
2250    __vki_kernel_time_t msg_stime ;   2250    __vki_kernel_time_t msg_stime ;
2251    __vki_kernel_time_t msg_rtime ;   2251    __vki_kernel_time_t msg_rtime ;
2252    __vki_kernel_time_t msg_ctime ;   2252    __vki_kernel_time_t msg_ctime ;
2253    unsigned long msg_lcbytes ;   2253    unsigned long msg_lcbytes ;
2254    unsigned long msg_lqbytes ;   2254    unsigned long msg_lqbytes ;
2255    unsigned short msg_cbytes ;   2255    unsigned short msg_cbytes ;
2256    unsigned short msg_qnum ;   2256    unsigned short msg_qnum ;
2257    unsigned short msg_qbytes ;   2257    unsigned short msg_qbytes ;
2258    __vki_kernel_ipc_pid_t msg_lspid ;   2258    __vki_kernel_ipc_pid_t msg_lspid ;
2259    __vki_kernel_ipc_pid_t msg_lrpid ;   2259    __vki_kernel_ipc_pid_t msg_lrpid ;
2260 };   2260 };
2261 struct vki_msgbuf {   2261 struct vki_msgbuf {
2262    long mtype ;   2262    long mtype ;
2263    char mtext[1] ;   2263    char mtext[1] ;
2264 };   2264 };
2265 struct vki_msginfo {   2265 struct vki_msginfo {
2266    int msgpool ;   2266    int msgpool ;
2267    int msgmap ;   2267    int msgmap ;
2268    int msgmax ;   2268    int msgmax ;
2269    int msgmnb ;   2269    int msgmnb ;
2270    int msgmni ;   2270    int msgmni ;
2271    int msgssz ;   2271    int msgssz ;
2272    int msgtql ;   2272    int msgtql ;
2273    unsigned short msgseg ;   2273    unsigned short msgseg ;
2274 };   2274 };
2275 struct vki_shmid_ds {   2275 struct vki_shmid_ds {
2276    struct vki_ipc_perm shm_perm ;   2276    struct vki_ipc_perm shm_perm ;
2277    int shm_segsz ;   2277    int shm_segsz ;
2278    __vki_kernel_time_t shm_atime ;   2278    __vki_kernel_time_t shm_atime ;
2279    __vki_kernel_time_t shm_dtime ;   2279    __vki_kernel_time_t shm_dtime ;
2280    __vki_kernel_time_t shm_ctime ;   2280    __vki_kernel_time_t shm_ctime ;
2281    __vki_kernel_ipc_pid_t shm_cpid ;   2281    __vki_kernel_ipc_pid_t shm_cpid ;
2282    __vki_kernel_ipc_pid_t shm_lpid ;   2282    __vki_kernel_ipc_pid_t shm_lpid ;
2283    unsigned short shm_nattch ;   2283    unsigned short shm_nattch ;
2284    unsigned short shm_unused ;   2284    unsigned short shm_unused ;
2285    void *shm_unused2 ;   2285    void *shm_unused2 ;
2286    void *shm_unused3 ;   2286    void *shm_unused3 ;
2287 };   2287 };
2288 struct vki_shminfo {   2288 struct vki_shminfo {
2289    int shmmax ;   2289    int shmmax ;
2290    int shmmin ;   2290    int shmmin ;
2291    int shmmni ;   2291    int shmmni ;
2292    int shmseg ;   2292    int shmseg ;
2293    int shmall ;   2293    int shmall ;
2294 };   2294 };
2295 struct vki_shm_info {   2295 struct vki_shm_info {
2296    int used_ids ;   2296    int used_ids ;
2297    unsigned long shm_tot ;   2297    unsigned long shm_tot ;
2298    unsigned long shm_rss ;   2298    unsigned long shm_rss ;
2299    unsigned long shm_swp ;   2299    unsigned long shm_swp ;
2300    unsigned long swap_attempts ;   2300    unsigned long swap_attempts ;
2301    unsigned long swap_successes ;   2301    unsigned long swap_successes ;
2302 };   2302 };
2303 struct vki_rtc_time {   2303 struct vki_rtc_time {
2304    int tm_sec ;   2304    int tm_sec ;
2305    int tm_min ;   2305    int tm_min ;
2306    int tm_hour ;   2306    int tm_hour ;
2307    int tm_mday ;   2307    int tm_mday ;
2308    int tm_mon ;   2308    int tm_mon ;
2309    int tm_year ;   2309    int tm_year ;
2310    int tm_wday ;   2310    int tm_wday ;
2311    int tm_yday ;   2311    int tm_yday ;
2312    int tm_isdst ;   2312    int tm_isdst ;
2313 };   2313 };
2314 struct __anonstruct_vki_isdn_net_ioctl_phone_84 {   2314 struct __anonstruct_vki_isdn_net_ioctl_phone_84 {
2315    char name[10] ;   2315    char name[10] ;
2316    char phone[32] ;   2316    char phone[32] ;
2317    int outgoing ;   2317    int outgoing ;
2318 };   2318 };
2319 typedef struct __anonstruct_vki_isdn_net_ioctl_phone_84 vki_isdn_net_ioctl_phone;   2319 typedef struct __anonstruct_vki_isdn_net_ioctl_phone_84 vki_isdn_net_ioctl_phone;
2320 struct vki_ppdev_frob_struct {   2320 struct vki_ppdev_frob_struct {
2321    unsigned char mask ;   2321    unsigned char mask ;
2322    unsigned char val ;   2322    unsigned char val ;
2323 };   2323 };
2324 struct vki_sg_io_hdr {   2324 struct vki_sg_io_hdr {
2325    int interface_id ;   2325    int interface_id ;
2326    int dxfer_direction ;   2326    int dxfer_direction ;
2327    unsigned char cmd_len ;   2327    unsigned char cmd_len ;
2328    unsigned char mx_sb_len ;   2328    unsigned char mx_sb_len ;
2329    unsigned short iovec_count ;   2329    unsigned short iovec_count ;
2330    unsigned int dxfer_len ;   2330    unsigned int dxfer_len ;
2331    void *dxferp ;   2331    void *dxferp ;
2332    unsigned char *cmdp ;   2332    unsigned char *cmdp ;
2333    void *sbp ;   2333    void *sbp ;
2334    unsigned int timeout ;   2334    unsigned int timeout ;
2335    unsigned int flags ;   2335    unsigned int flags ;
2336    int pack_id ;   2336    int pack_id ;
2337    void *usr_ptr ;   2337    void *usr_ptr ;
2338    unsigned char status ;   2338    unsigned char status ;
2339    unsigned char masked_status ;   2339    unsigned char masked_status ;
2340    unsigned char msg_status ;   2340    unsigned char msg_status ;
2341    unsigned char sb_len_wr ;   2341    unsigned char sb_len_wr ;
2342    unsigned short host_status ;   2342    unsigned short host_status ;
2343    unsigned short driver_status ;   2343    unsigned short driver_status ;
2344    int resid ;   2344    int resid ;
2345    unsigned int duration ;   2345    unsigned int duration ;
2346    unsigned int info ;   2346    unsigned int info ;
2347 };   2347 };
2348 typedef struct vki_sg_io_hdr vki_sg_io_hdr_t;   2348 typedef struct vki_sg_io_hdr vki_sg_io_hdr_t;
2349 struct vki_sg_scsi_id {   2349 struct vki_sg_scsi_id {
2350    int host_no ;   2350    int host_no ;
2351    int channel ;   2351    int channel ;
2352    int scsi_id ;   2352    int scsi_id ;
2353    int lun ;   2353    int lun ;
2354    int scsi_type ;   2354    int scsi_type ;
2355    short h_cmd_per_lun ;   2355    short h_cmd_per_lun ;
2356    short d_queue_depth ;   2356    short d_queue_depth ;
2357    int unused[2] ;   2357    int unused[2] ;
2358 };   2358 };
2359 typedef struct vki_sg_scsi_id vki_sg_scsi_id_t;   2359 typedef struct vki_sg_scsi_id vki_sg_scsi_id_t;
2360 struct vki_cdrom_msf0 {   2360 struct vki_cdrom_msf0 {
2361    __vki_u8 minute ;   2361    __vki_u8 minute ;
2362    __vki_u8 second ;   2362    __vki_u8 second ;
2363    __vki_u8 frame ;   2363    __vki_u8 frame ;
2364 };   2364 };
2365 union vki_cdrom_addr {   2365 union vki_cdrom_addr {
2366    struct vki_cdrom_msf0 msf ;   2366    struct vki_cdrom_msf0 msf ;
2367    int lba ;   2367    int lba ;
2368 };   2368 };
2369 struct vki_cdrom_msf {   2369 struct vki_cdrom_msf {
2370    __vki_u8 cdmsf_min0 ;   2370    __vki_u8 cdmsf_min0 ;
2371    __vki_u8 cdmsf_sec0 ;   2371    __vki_u8 cdmsf_sec0 ;
2372    __vki_u8 cdmsf_frame0 ;   2372    __vki_u8 cdmsf_frame0 ;
2373    __vki_u8 cdmsf_min1 ;   2373    __vki_u8 cdmsf_min1 ;
2374    __vki_u8 cdmsf_sec1 ;   2374    __vki_u8 cdmsf_sec1 ;
2375    __vki_u8 cdmsf_frame1 ;   2375    __vki_u8 cdmsf_frame1 ;
2376 };   2376 };
2377 struct vki_cdrom_tochdr {   2377 struct vki_cdrom_tochdr {
2378    __vki_u8 cdth_trk0 ;   2378    __vki_u8 cdth_trk0 ;
2379    __vki_u8 cdth_trk1 ;   2379    __vki_u8 cdth_trk1 ;
2380 };   2380 };
2381 struct vki_cdrom_volctrl {   2381 struct vki_cdrom_volctrl {
2382    __vki_u8 channel0 ;   2382    __vki_u8 channel0 ;
2383    __vki_u8 channel1 ;   2383    __vki_u8 channel1 ;
2384    __vki_u8 channel2 ;   2384    __vki_u8 channel2 ;
2385    __vki_u8 channel3 ;   2385    __vki_u8 channel3 ;
2386 };   2386 };
2387 struct vki_cdrom_subchnl {   2387 struct vki_cdrom_subchnl {
2388    __vki_u8 cdsc_format ;   2388    __vki_u8 cdsc_format ;
2389    __vki_u8 cdsc_audiostatus ;   2389    __vki_u8 cdsc_audiostatus ;
2390    __vki_u8 cdsc_adr : 4 ;   2390    __vki_u8 cdsc_adr : 4 ;
2391    __vki_u8 cdsc_ctrl : 4 ;   2391    __vki_u8 cdsc_ctrl : 4 ;
2392    __vki_u8 cdsc_trk ;   2392    __vki_u8 cdsc_trk ;
2393    __vki_u8 cdsc_ind ;   2393    __vki_u8 cdsc_ind ;
2394    union vki_cdrom_addr cdsc_absaddr ;   2394    union vki_cdrom_addr cdsc_absaddr ;
2395    union vki_cdrom_addr cdsc_reladdr ;   2395    union vki_cdrom_addr cdsc_reladdr ;
2396 };   2396 };
2397 struct vki_cdrom_tocentry {   2397 struct vki_cdrom_tocentry {
2398    __vki_u8 cdte_track ;   2398    __vki_u8 cdte_track ;
2399    __vki_u8 cdte_adr : 4 ;   2399    __vki_u8 cdte_adr : 4 ;
2400    __vki_u8 cdte_ctrl : 4 ;   2400    __vki_u8 cdte_ctrl : 4 ;
2401    __vki_u8 cdte_format ;   2401    __vki_u8 cdte_format ;
2402    union vki_cdrom_addr cdte_addr ;   2402    union vki_cdrom_addr cdte_addr ;
2403    __vki_u8 cdte_datamode ;   2403    __vki_u8 cdte_datamode ;
2404 };   2404 };
2405 struct vki_cdrom_read {   2405 struct vki_cdrom_read {
2406    int cdread_lba ;   2406    int cdread_lba ;
2407    char *cdread_bufaddr ;   2407    char *cdread_bufaddr ;
2408    int cdread_buflen ;   2408    int cdread_buflen ;
2409 };   2409 };
2410 struct vki_cdrom_read_audio {   2410 struct vki_cdrom_read_audio {
2411    union vki_cdrom_addr addr ;   2411    union vki_cdrom_addr addr ;
2412    __vki_u8 addr_format ;   2412    __vki_u8 addr_format ;
2413    int nframes ;   2413    int nframes ;
2414    __vki_u8 *buf ;   2414    __vki_u8 *buf ;
2415 };   2415 };
2416 struct vki_cdrom_multisession {   2416 struct vki_cdrom_multisession {
2417    union vki_cdrom_addr addr ;   2417    union vki_cdrom_addr addr ;
2418    __vki_u8 xa_flag ;   2418    __vki_u8 xa_flag ;
2419    __vki_u8 addr_format ;   2419    __vki_u8 addr_format ;
2420 };   2420 };
2421 struct vki_cdrom_mcn {   2421 struct vki_cdrom_mcn {
2422    __vki_u8 medium_catalog_number[14] ;   2422    __vki_u8 medium_catalog_number[14] ;
2423 };   2423 };
2424 struct vki_cdrom_generic_command {   2424 struct vki_cdrom_generic_command {
2425    unsigned char cmd[12] ;   2425    unsigned char cmd[12] ;
2426    unsigned char *buffer ;   2426    unsigned char *buffer ;
2427    unsigned int buflen ;   2427    unsigned int buflen ;
2428    int stat ;   2428    int stat ;
2429    void *sense ;   2429    void *sense ;
2430    unsigned char data_direction ;   2430    unsigned char data_direction ;
2431    int quiet ;   2431    int quiet ;
2432    int timeout ;   2432    int timeout ;
2433    void *reserved[1] ;   2433    void *reserved[1] ;
2434 };   2434 };
2435 struct vki_audio_buf_info {   2435 struct vki_audio_buf_info {
2436    int fragments ;   2436    int fragments ;
2437    int fragstotal ;   2437    int fragstotal ;
2438    int fragsize ;   2438    int fragsize ;
2439    int bytes ;   2439    int bytes ;
2440 };   2440 };
2441 typedef struct vki_audio_buf_info vki_audio_buf_info;   2441 typedef struct vki_audio_buf_info vki_audio_buf_info;
2442 struct vki_hd_geometry {   2442 struct vki_hd_geometry {
2443    unsigned char heads ;   2443    unsigned char heads ;
2444    unsigned char sectors ;   2444    unsigned char sectors ;
2445    unsigned short cylinders ;   2445    unsigned short cylinders ;
2446    unsigned long start ;   2446    unsigned long start ;
2447 };   2447 };
2448 struct vki_fb_fix_screeninfo {   2448 struct vki_fb_fix_screeninfo {
2449    char id[16] ;   2449    char id[16] ;
2450    unsigned long smem_start ;   2450    unsigned long smem_start ;
2451    __vki_u32 smem_len ;   2451    __vki_u32 smem_len ;
2452    __vki_u32 type ;   2452    __vki_u32 type ;
2453    __vki_u32 type_aux ;   2453    __vki_u32 type_aux ;
2454    __vki_u32 visual ;   2454    __vki_u32 visual ;
2455    __vki_u16 xpanstep ;   2455    __vki_u16 xpanstep ;
2456    __vki_u16 ypanstep ;   2456    __vki_u16 ypanstep ;
2457    __vki_u16 ywrapstep ;   2457    __vki_u16 ywrapstep ;
2458    __vki_u32 line_length ;   2458    __vki_u32 line_length ;
2459    unsigned long mmio_start ;   2459    unsigned long mmio_start ;
2460    __vki_u32 mmio_len ;   2460    __vki_u32 mmio_len ;
2461    __vki_u32 accel ;   2461    __vki_u32 accel ;
2462    __vki_u16 reserved[3] ;   2462    __vki_u16 reserved[3] ;
2463 };   2463 };
2464 struct vki_fb_bitfield {   2464 struct vki_fb_bitfield {
2465    __vki_u32 offset ;   2465    __vki_u32 offset ;
2466    __vki_u32 length ;   2466    __vki_u32 length ;
2467    __vki_u32 msb_right ;   2467    __vki_u32 msb_right ;
2468 };   2468 };
2469 struct vki_fb_var_screeninfo {   2469 struct vki_fb_var_screeninfo {
2470    __vki_u32 xres ;   2470    __vki_u32 xres ;
2471    __vki_u32 yres ;   2471    __vki_u32 yres ;
2472    __vki_u32 xres_virtual ;   2472    __vki_u32 xres_virtual ;
2473    __vki_u32 yres_virtual ;   2473    __vki_u32 yres_virtual ;
2474    __vki_u32 xoffset ;   2474    __vki_u32 xoffset ;
2475    __vki_u32 yoffset ;   2475    __vki_u32 yoffset ;
2476    __vki_u32 bits_per_pixel ;   2476    __vki_u32 bits_per_pixel ;
2477    __vki_u32 grayscale ;   2477    __vki_u32 grayscale ;
2478    struct vki_fb_bitfield red ;   2478    struct vki_fb_bitfield red ;
2479    struct vki_fb_bitfield green ;   2479    struct vki_fb_bitfield green ;
2480    struct vki_fb_bitfield blue ;   2480    struct vki_fb_bitfield blue ;
2481    struct vki_fb_bitfield transp ;   2481    struct vki_fb_bitfield transp ;
2482    __vki_u32 nonstd ;   2482    __vki_u32 nonstd ;
2483    __vki_u32 activate ;   2483    __vki_u32 activate ;
2484    __vki_u32 height ;   2484    __vki_u32 height ;
2485    __vki_u32 width ;   2485    __vki_u32 width ;
2486    __vki_u32 accel_flags ;   2486    __vki_u32 accel_flags ;
2487    __vki_u32 pixclock ;   2487    __vki_u32 pixclock ;
2488    __vki_u32 left_margin ;   2488    __vki_u32 left_margin ;
2489    __vki_u32 right_margin ;   2489    __vki_u32 right_margin ;
2490    __vki_u32 upper_margin ;   2490    __vki_u32 upper_margin ;
2491    __vki_u32 lower_margin ;   2491    __vki_u32 lower_margin ;
2492    __vki_u32 hsync_len ;   2492    __vki_u32 hsync_len ;
2493    __vki_u32 vsync_len ;   2493    __vki_u32 vsync_len ;
2494    __vki_u32 sync ;   2494    __vki_u32 sync ;
2495    __vki_u32 vmode ;   2495    __vki_u32 vmode ;
2496    __vki_u32 rotate ;   2496    __vki_u32 rotate ;
2497    __vki_u32 reserved[5] ;   2497    __vki_u32 reserved[5] ;
2498 };   2498 };
2499 struct vki_consolefontdesc {   2499 struct vki_consolefontdesc {
2500    unsigned short charcount ;   2500    unsigned short charcount ;
2501    unsigned short charheight ;   2501    unsigned short charheight ;
2502    char *chardata ;   2502    char *chardata ;
2503 };   2503 };
2504 struct vki_unipair {   2504 struct vki_unipair {
2505    unsigned short unicode ;   2505    unsigned short unicode ;
2506    unsigned short fontpos ;   2506    unsigned short fontpos ;
2507 };   2507 };
2508 struct vki_unimapdesc {   2508 struct vki_unimapdesc {
2509    unsigned short entry_ct ;   2509    unsigned short entry_ct ;
2510    struct vki_unipair *entries ;   2510    struct vki_unipair *entries ;
2511 };   2511 };
2512 struct vki_unimapinit {   2512 struct vki_unimapinit {
2513    unsigned short advised_hashsize ;   2513    unsigned short advised_hashsize ;
2514    unsigned short advised_hashstep ;   2514    unsigned short advised_hashstep ;
2515    unsigned short advised_hashlevel ;   2515    unsigned short advised_hashlevel ;
2516 };   2516 };
2517 struct vki_kbentry {   2517 struct vki_kbentry {
2518    unsigned char kb_table ;   2518    unsigned char kb_table ;
2519    unsigned char kb_index ;   2519    unsigned char kb_index ;
2520    unsigned short kb_value ;   2520    unsigned short kb_value ;
2521 };   2521 };
2522 struct vki_kbsentry {   2522 struct vki_kbsentry {
2523    unsigned char kb_func ;   2523    unsigned char kb_func ;
2524    unsigned char kb_string[512] ;   2524    unsigned char kb_string[512] ;
2525 };   2525 };
2526 struct vki_kbdiacr {   2526 struct vki_kbdiacr {
2527    unsigned char diacr ;   2527    unsigned char diacr ;
2528    unsigned char base ;   2528    unsigned char base ;
2529    unsigned char result ;   2529    unsigned char result ;
2530 };   2530 };
2531 struct vki_kbdiacrs {   2531 struct vki_kbdiacrs {
2532    unsigned int kb_cnt ;   2532    unsigned int kb_cnt ;
2533    struct vki_kbdiacr kbdiacr[256] ;   2533    struct vki_kbdiacr kbdiacr[256] ;
2534 };   2534 };
2535 struct vki_kbkeycode {   2535 struct vki_kbkeycode {
2536    unsigned int scancode ;   2536    unsigned int scancode ;
2537    unsigned int keycode ;   2537    unsigned int keycode ;
2538 };   2538 };
2539 struct vki_kbd_repeat {   2539 struct vki_kbd_repeat {
2540    int delay ;   2540    int delay ;
2541    int period ;   2541    int period ;
2542 };   2542 };
2543 struct vki_console_font_op {   2543 struct vki_console_font_op {
2544    unsigned int op ;   2544    unsigned int op ;
2545    unsigned int flags ;   2545    unsigned int flags ;
2546    unsigned int width ;   2546    unsigned int width ;
2547    unsigned int height ;   2547    unsigned int height ;
2548    unsigned int charcount ;   2548    unsigned int charcount ;
2549    unsigned char *data ;   2549    unsigned char *data ;
2550 };   2550 };
2551 typedef __vki_kernel_uid32_t vki_qid_t;   2551 typedef __vki_kernel_uid32_t vki_qid_t;
2552 struct __anonstruct_86 {   2552 struct __anonstruct_86 {
2553    int  : 0 ;   2553    int  : 0 ;
2554 };   2554 };
2555 struct __anonstruct_87 {   2555 struct __anonstruct_87 {
2556    int  : 0 ;   2556    int  : 0 ;
2557 };   2557 };
2558 enum __anonenum_85 {   2558 enum __anonenum_85 {
2559     VKI_SNDRV_PCM_IOCTL_HW_FREE = 16658,   2559     VKI_SNDRV_PCM_IOCTL_HW_FREE = 16658,
2560     VKI_SNDRV_PCM_IOCTL_HWSYNC = 16674,   2560     VKI_SNDRV_PCM_IOCTL_HWSYNC = 16674,
2561     VKI_SNDRV_PCM_IOCTL_PREPARE = 16704,   2561     VKI_SNDRV_PCM_IOCTL_PREPARE = 16704,
2562     VKI_SNDRV_PCM_IOCTL_RESET = 16705,   2562     VKI_SNDRV_PCM_IOCTL_RESET = 16705,
2563     VKI_SNDRV_PCM_IOCTL_START = 16706,   2563     VKI_SNDRV_PCM_IOCTL_START = 16706,
2564     VKI_SNDRV_PCM_IOCTL_DROP = 16707,   2564     VKI_SNDRV_PCM_IOCTL_DROP = 16707,
2565     VKI_SNDRV_PCM_IOCTL_DRAIN = 16708,   2565     VKI_SNDRV_PCM_IOCTL_DRAIN = 16708,
2566     VKI_SNDRV_PCM_IOCTL_PAUSE = 1074020677,   2566     VKI_SNDRV_PCM_IOCTL_PAUSE = 1074020677,
2567     VKI_SNDRV_PCM_IOCTL_RESUME = 16711,   2567     VKI_SNDRV_PCM_IOCTL_RESUME = 16711,
2568     VKI_SNDRV_PCM_IOCTL_XRUN = 16712,   2568     VKI_SNDRV_PCM_IOCTL_XRUN = 16712,
2569     VKI_SNDRV_PCM_IOCTL_LINK = 1074020704,   2569     VKI_SNDRV_PCM_IOCTL_LINK = 1074020704,
2570     VKI_SNDRV_PCM_IOCTL_UNLINK = 16737   2570     VKI_SNDRV_PCM_IOCTL_UNLINK = 16737
2571 } ;   2571 } ;
2572 enum __anonenum_88 {   2572 enum __anonenum_88 {
2573     VKI_SNDRV_TIMER_IOCTL_START = 21664,   2573     VKI_SNDRV_TIMER_IOCTL_START = 21664,
2574     VKI_SNDRV_TIMER_IOCTL_STOP = 21665,   2574     VKI_SNDRV_TIMER_IOCTL_STOP = 21665,
2575     VKI_SNDRV_TIMER_IOCTL_CONTINUE = 21666,   2575     VKI_SNDRV_TIMER_IOCTL_CONTINUE = 21666,
2576     VKI_SNDRV_TIMER_IOCTL_PAUSE = 21667   2576     VKI_SNDRV_TIMER_IOCTL_PAUSE = 21667
2577 } ;   2577 } ;
2578 struct vki_serial_icounter_struct {   2578 struct vki_serial_icounter_struct {
2579    int cts ;   2579    int cts ;
2580    int dsr ;   2580    int dsr ;
2581    int rng ;   2581    int rng ;
2582    int dcd ;   2582    int dcd ;
2583    int rx ;   2583    int rx ;
2584    int tx ;   2584    int tx ;
2585    int frame ;   2585    int frame ;
2586    int overrun ;   2586    int overrun ;
2587    int parity ;   2587    int parity ;
2588    int brk ;   2588    int brk ;
2589    int buf_overrun ;   2589    int buf_overrun ;
2590    int reserved[9] ;   2590    int reserved[9] ;
2591 };   2591 };
2592 struct vki_vt_mode {   2592 struct vki_vt_mode {
2593    char mode ;   2593    char mode ;
2594    char waitv ;   2594    char waitv ;
2595    short relsig ;   2595    short relsig ;
2596    short acqsig ;   2596    short acqsig ;
2597    short frsig ;   2597    short frsig ;
2598 };   2598 };
2599 struct vki_vt_stat {   2599 struct vki_vt_stat {
2600    unsigned short v_active ;   2600    unsigned short v_active ;
2601    unsigned short v_signal ;   2601    unsigned short v_signal ;
2602    unsigned short v_state ;   2602    unsigned short v_state ;
2603 };   2603 };
2604 struct vki_vt_sizes {   2604 struct vki_vt_sizes {
2605    unsigned short v_rows ;   2605    unsigned short v_rows ;
2606    unsigned short v_cols ;   2606    unsigned short v_cols ;
2607    unsigned short v_scrollsize ;   2607    unsigned short v_scrollsize ;
2608 };   2608 };
2609 struct vki_vt_consize {   2609 struct vki_vt_consize {
2610    unsigned short v_rows ;   2610    unsigned short v_rows ;
2611    unsigned short v_cols ;   2611    unsigned short v_cols ;
2612    unsigned short v_vlin ;   2612    unsigned short v_vlin ;
2613    unsigned short v_clin ;   2613    unsigned short v_clin ;
2614    unsigned short v_vcol ;   2614    unsigned short v_vcol ;
2615    unsigned short v_ccol ;   2615    unsigned short v_ccol ;
2616 };   2616 };
2617 struct vki_usbdevfs_ctrltransfer {   2617 struct vki_usbdevfs_ctrltransfer {
2618    __vki_u8 bRequestType ;   2618    __vki_u8 bRequestType ;
2619    __vki_u8 bRequest ;   2619    __vki_u8 bRequest ;
2620    __vki_u16 wValue ;   2620    __vki_u16 wValue ;
2621    __vki_u16 wIndex ;   2621    __vki_u16 wIndex ;
2622    __vki_u16 wLength ;   2622    __vki_u16 wLength ;
2623    __vki_u32 timeout ;   2623    __vki_u32 timeout ;
2624    void *data ;   2624    void *data ;
2625 };   2625 };
2626 struct vki_usbdevfs_bulktransfer {   2626 struct vki_usbdevfs_bulktransfer {
2627    unsigned int ep ;   2627    unsigned int ep ;
2628    unsigned int len ;   2628    unsigned int len ;
2629    unsigned int timeout ;   2629    unsigned int timeout ;
2630    void *data ;   2630    void *data ;
2631 };   2631 };
2632 struct vki_usbdevfs_getdriver {   2632 struct vki_usbdevfs_getdriver {
2633    unsigned int interface ;   2633    unsigned int interface ;
2634    char driver[256] ;   2634    char driver[256] ;
2635 };   2635 };
2636 struct vki_usbdevfs_connectinfo {   2636 struct vki_usbdevfs_connectinfo {
2637    unsigned int devnum ;   2637    unsigned int devnum ;
2638    unsigned char slow ;   2638    unsigned char slow ;
2639 };   2639 };
2640 struct vki_usbdevfs_iso_packet_desc {   2640 struct vki_usbdevfs_iso_packet_desc {
2641    unsigned int length ;   2641    unsigned int length ;
2642    unsigned int actual_length ;   2642    unsigned int actual_length ;
2643    unsigned int status ;   2643    unsigned int status ;
2644 };   2644 };
2645 struct vki_usbdevfs_urb {   2645 struct vki_usbdevfs_urb {
2646    unsigned char type ;   2646    unsigned char type ;
2647    unsigned char endpoint ;   2647    unsigned char endpoint ;
2648    int status ;   2648    int status ;
2649    unsigned int flags ;   2649    unsigned int flags ;
2650    void *buffer ;   2650    void *buffer ;
2651    int buffer_length ;   2651    int buffer_length ;
2652    int actual_length ;   2652    int actual_length ;
2653    int start_frame ;   2653    int start_frame ;
2654    int number_of_packets ;   2654    int number_of_packets ;
2655    int error_count ;   2655    int error_count ;
2656    unsigned int signr ;   2656    unsigned int signr ;
2657    void *usercontext ;   2657    void *usercontext ;
2658    struct vki_usbdevfs_iso_packet_desc iso_frame_desc[0] ;   2658    struct vki_usbdevfs_iso_packet_desc iso_frame_desc[0] ;
2659 };   2659 };
2660 struct vki_usbdevfs_ioctl {   2660 struct vki_usbdevfs_ioctl {
2661    int ifno ;   2661    int ifno ;
2662    int ioctl_code ;   2662    int ioctl_code ;
2663    void *data ;   2663    void *data ;
2664 };   2664 };
2665 struct vki_usbdevfs_setuppacket {   2665 struct vki_usbdevfs_setuppacket {
2666    __vki_u8 bRequestType ;   2666    __vki_u8 bRequestType ;
2667    __vki_u8 bRequest ;   2667    __vki_u8 bRequest ;
2668    __vki_u16 wValue ;   2668    __vki_u16 wValue ;
2669    __vki_u16 wIndex ;   2669    __vki_u16 wIndex ;
2670    __vki_u16 wLength ;   2670    __vki_u16 wLength ;
2671 };   2671 };
2672 typedef vki_int32_t vki_key_serial_t;   2672 typedef vki_int32_t vki_key_serial_t;
2673 typedef vki_uint32_t vki_key_perm_t;   2673 typedef vki_uint32_t vki_key_perm_t;
2674 struct vki_iw_param {   2674 struct vki_iw_param {
2675    __vki_s32 value ;   2675    __vki_s32 value ;
2676    __vki_u8 fixed ;   2676    __vki_u8 fixed ;
2677    __vki_u8 disabled ;   2677    __vki_u8 disabled ;
2678    __vki_u16 flags ;   2678    __vki_u16 flags ;
2679 };   2679 };
2680 struct vki_iw_point {   2680 struct vki_iw_point {
2681    void *pointer ;   2681    void *pointer ;
2682    __vki_u16 length ;   2682    __vki_u16 length ;
2683    __vki_u16 flags ;   2683    __vki_u16 flags ;
2684 };   2684 };
2685 struct vki_iw_freq {   2685 struct vki_iw_freq {
2686    __vki_s32 m ;   2686    __vki_s32 m ;
2687    __vki_s16 e ;   2687    __vki_s16 e ;
2688    __vki_u8 i ;   2688    __vki_u8 i ;
2689    __vki_u8 flags ;   2689    __vki_u8 flags ;
2690 };   2690 };
2691 struct vki_iw_quality {   2691 struct vki_iw_quality {
2692    __vki_u8 qual ;   2692    __vki_u8 qual ;
2693    __vki_u8 level ;   2693    __vki_u8 level ;
2694    __vki_u8 noise ;   2694    __vki_u8 noise ;
2695    __vki_u8 updated ;   2695    __vki_u8 updated ;
2696 };   2696 };
2697 union vki_iwreq_data {   2697 union vki_iwreq_data {
2698    char name[16] ;   2698    char name[16] ;
2699    struct vki_iw_point essid ;   2699    struct vki_iw_point essid ;
2700    struct vki_iw_param nwid ;   2700    struct vki_iw_param nwid ;
2701    struct vki_iw_freq freq ;   2701    struct vki_iw_freq freq ;
2702    struct vki_iw_param sens ;   2702    struct vki_iw_param sens ;
2703    struct vki_iw_param bitrate ;   2703    struct vki_iw_param bitrate ;
2704    struct vki_iw_param txpower ;   2704    struct vki_iw_param txpower ;
2705    struct vki_iw_param rts ;   2705    struct vki_iw_param rts ;
2706    struct vki_iw_param frag ;   2706    struct vki_iw_param frag ;
2707    __vki_u32 mode ;   2707    __vki_u32 mode ;
2708    struct vki_iw_param retry ;   2708    struct vki_iw_param retry ;
2709    struct vki_iw_point encoding ;   2709    struct vki_iw_point encoding ;
2710    struct vki_iw_param power ;   2710    struct vki_iw_param power ;
2711    struct vki_iw_quality qual ;   2711    struct vki_iw_quality qual ;
2712    struct vki_sockaddr ap_addr ;   2712    struct vki_sockaddr ap_addr ;
2713    struct vki_sockaddr addr ;   2713    struct vki_sockaddr addr ;
2714    struct vki_iw_param param ;   2714    struct vki_iw_param param ;
2715    struct vki_iw_point data ;   2715    struct vki_iw_point data ;
2716 };   2716 };
2717 union __anonunion_ifr_ifrn_89 {   2717 union __anonunion_ifr_ifrn_89 {
2718    char ifrn_name[16] ;   2718    char ifrn_name[16] ;
2719 };   2719 };
2720 struct vki_iwreq {   2720 struct vki_iwreq {
2721    union __anonunion_ifr_ifrn_89 ifr_ifrn ;   2721    union __anonunion_ifr_ifrn_89 ifr_ifrn ;
2722    union vki_iwreq_data u ;   2722    union vki_iwreq_data u ;
2723 };   2723 };
2724 union __anonunion____missing_field_name_90 {   2724 union __anonunion____missing_field_name_90 {
2725    __vki_u64 sample_period ;   2725    __vki_u64 sample_period ;
2726    __vki_u64 sample_freq ;   2726    __vki_u64 sample_freq ;
2727 };   2727 };
2728 struct vki_perf_counter_attr {   2728 struct vki_perf_counter_attr {
2729    __vki_u32 type ;   2729    __vki_u32 type ;
2730    __vki_u32 size ;   2730    __vki_u32 size ;
2731    __vki_u64 config ;   2731    __vki_u64 config ;
2732    union __anonunion____missing_field_name_90 __annonCompField1 ;   2732    union __anonunion____missing_field_name_90 __annonCompField1 ;
2733    __vki_u64 sample_type ;   2733    __vki_u64 sample_type ;
2734    __vki_u64 read_format ;   2734    __vki_u64 read_format ;
2735    __vki_u64 disabled : 1 ;   2735    __vki_u64 disabled : 1 ;
2736    __vki_u64 inherit : 1 ;   2736    __vki_u64 inherit : 1 ;
2737    __vki_u64 pinned : 1 ;   2737    __vki_u64 pinned : 1 ;
2738    __vki_u64 exclusive : 1 ;   2738    __vki_u64 exclusive : 1 ;
2739    __vki_u64 exclude_user : 1 ;   2739    __vki_u64 exclude_user : 1 ;
2740    __vki_u64 exclude_kernel : 1 ;   2740    __vki_u64 exclude_kernel : 1 ;
2741    __vki_u64 exclude_hv : 1 ;   2741    __vki_u64 exclude_hv : 1 ;
2742    __vki_u64 exclude_idle : 1 ;   2742    __vki_u64 exclude_idle : 1 ;
2743    __vki_u64 mmap : 1 ;   2743    __vki_u64 mmap : 1 ;
2744    __vki_u64 comm : 1 ;   2744    __vki_u64 comm : 1 ;
2745    __vki_u64 freq : 1 ;   2745    __vki_u64 freq : 1 ;
2746    __vki_u64 inherit_stat : 1 ;   2746    __vki_u64 inherit_stat : 1 ;
2747    __vki_u64 enable_on_exec : 1 ;   2747    __vki_u64 enable_on_exec : 1 ;
2748    __vki_u64 task : 1 ;   2748    __vki_u64 task : 1 ;
2749    __vki_u64 __reserved_1 : 50 ;   2749    __vki_u64 __reserved_1 : 50 ;
2750    __vki_u32 wakeup_events ;   2750    __vki_u32 wakeup_events ;
2751    __vki_u32 __reserved_2 ;   2751    __vki_u32 __reserved_2 ;
2752    __vki_u64 __reserved_3 ;   2752    __vki_u64 __reserved_3 ;
2753 };   2753 };
2754 struct vki_getcpu_cache {   2754 struct vki_getcpu_cache {
2755    unsigned long blob[128U / sizeof(long )] ;   2755    unsigned long blob[128U / sizeof(long )] ;
2756 };   2756 };
2757 typedef void (*vg_atfork_t)(ThreadId  );   2757 typedef void (*vg_atfork_t)(ThreadId  );
2758 enum __anonenum_SegKind_91 {   2758 enum __anonenum_SegKind_91 {
2759     SkFree = 0,   2759     SkFree = 0,
2760     SkAnonC = 1,   2760     SkAnonC = 1,
2761     SkAnonV = 2,   2761     SkAnonV = 2,
2762     SkFileC = 3,   2762     SkFileC = 3,
2763     SkFileV = 4,   2763     SkFileV = 4,
2764     SkShmC = 5,   2764     SkShmC = 5,
2765     SkResvn = 6   2765     SkResvn = 6
2766 } ;   2766 } ;
2767 typedef enum __anonenum_SegKind_91 SegKind;   2767 typedef enum __anonenum_SegKind_91 SegKind;
2768 enum __anonenum_ShrinkMode_92 {   2768 enum __anonenum_ShrinkMode_92 {
2769     SmLower = 0,   2769     SmLower = 0,
2770     SmFixed = 1,   2770     SmFixed = 1,
2771     SmUpper = 2   2771     SmUpper = 2
2772 } ;   2772 } ;
2773 typedef enum __anonenum_ShrinkMode_92 ShrinkMode;   2773 typedef enum __anonenum_ShrinkMode_92 ShrinkMode;
2774 struct __anonstruct_NSegment_93 {   2774 struct __anonstruct_NSegment_93 {
2775    SegKind kind ;   2775    SegKind kind ;
2776    Addr start ;   2776    Addr start ;
2777    Addr end ;   2777    Addr end ;
2778    ShrinkMode smode ;   2778    ShrinkMode smode ;
2779    ULong dev ;   2779    ULong dev ;
2780    ULong ino ;   2780    ULong ino ;
2781    Off64T offset ;   2781    Off64T offset ;
2782    UInt mode ;   2782    UInt mode ;
2783    Int fnIdx ;   2783    Int fnIdx ;
2784    Bool hasR ;   2784    Bool hasR ;
2785    Bool hasW ;   2785    Bool hasW ;
2786    Bool hasX ;   2786    Bool hasX ;
2787    Bool hasT ;   2787    Bool hasT ;
2788    Bool isCH ;   2788    Bool isCH ;
2789    Bool mark ;   2789    Bool mark ;
2790 };   2790 };
2791 typedef struct __anonstruct_NSegment_93 NSegment;   2791 typedef struct __anonstruct_NSegment_93 NSegment;
2792 struct _WordSetU;   2792 struct _WordSetU;
2793 typedef struct _WordSetU WordSetU;   2793 typedef struct _WordSetU WordSetU;
2794 typedef UInt WordSet;   2794 typedef UInt WordSet;
2795 typedef WordSet WordSetID;   2795 typedef WordSet WordSetID;
2796 struct _SO;   2796 struct _SO;
2797 typedef struct _SO SO;   2797 typedef struct _SO SO;
2798 struct _Thr;   2798 struct _Thr;
2799 typedef struct _Thr Thr;   2799 typedef struct _Thr Thr;
2800 typedef UInt ThrID;   2800 typedef UInt ThrID;
2801 struct _Thread {   2801 struct _Thread {
2802    struct _Thread *admin ;   2802    struct _Thread *admin ;
2803    UInt magic ;   2803    UInt magic ;
2804    Thr *hbthr ;   2804    Thr *hbthr ;
2805    ThreadId coretid ;   2805    ThreadId coretid ;
2806    WordSetID locksetA ;   2806    WordSetID locksetA ;
2807    WordSetID locksetW ;   2807    WordSetID locksetW ;
2808    ExeContext *created_at ;   2808    ExeContext *created_at ;
2809    Bool announced ;   2809    Bool announced ;
2810    Int errmsg_index ;   2810    Int errmsg_index ;
2811 };   2811 };
2812 typedef struct _Thread Thread;   2812 typedef struct _Thread Thread;
2813 enum __anonenum_LockKind_94 {   2813 enum __anonenum_LockKind_94 {
2814     LK_mbRec = 1001,   2814     LK_mbRec = 1001,
2815     LK_nonRec = 1002,   2815     LK_nonRec = 1002,
2816     LK_rdwr = 1003   2816     LK_rdwr = 1003
2817 } ;   2817 } ;
2818 typedef enum __anonenum_LockKind_94 LockKind;   2818 typedef enum __anonenum_LockKind_94 LockKind;
2819 struct _Lock {   2819 struct _Lock {
2820    struct _Lock *admin_next ;   2820    struct _Lock *admin_next ;
2821    struct _Lock *admin_prev ;   2821    struct _Lock *admin_prev ;
2822    ULong unique ;   2822    ULong unique ;
2823    UInt magic ;   2823    UInt magic ;
2824    ExeContext *appeared_at ;   2824    ExeContext *appeared_at ;
2825    ExeContext *acquired_at ;   2825    ExeContext *acquired_at ;
2826    SO *hbso ;   2826    SO *hbso ;
2827    Addr guestaddr ;   2827    Addr guestaddr ;
2828    LockKind kind ;   2828    LockKind kind ;
2829    Bool heldW ;   2829    Bool heldW ;
2830    WordBag *heldBy ;   2830    WordBag *heldBy ;
2831 };   2831 };
2832 typedef struct _Lock Lock;   2832 typedef struct _Lock Lock;
2833 struct __anonstruct_OrigFn_95 {   2833 struct __anonstruct_OrigFn_95 {
2834    unsigned int nraddr ;   2834    unsigned int nraddr ;
2835 };   2835 };
2836 typedef struct __anonstruct_OrigFn_95 OrigFn;   2836 typedef struct __anonstruct_OrigFn_95 OrigFn;
2837 enum __anonenum_Vg_ClientRequest_96 {   2837 enum __anonenum_Vg_ClientRequest_96 {
2838     VG_USERREQ__RUNNING_ON_VALGRIND = 4097,   2838     VG_USERREQ__RUNNING_ON_VALGRIND = 4097,
2839     VG_USERREQ__DISCARD_TRANSLATIONS = 4098,   2839     VG_USERREQ__DISCARD_TRANSLATIONS = 4098,
2840     VG_USERREQ__CLIENT_CALL0 = 4353,   2840     VG_USERREQ__CLIENT_CALL0 = 4353,
2841     VG_USERREQ__CLIENT_CALL1 = 4354,   2841     VG_USERREQ__CLIENT_CALL1 = 4354,
2842     VG_USERREQ__CLIENT_CALL2 = 4355,   2842     VG_USERREQ__CLIENT_CALL2 = 4355,
2843     VG_USERREQ__CLIENT_CALL3 = 4356,   2843     VG_USERREQ__CLIENT_CALL3 = 4356,
2844     VG_USERREQ__COUNT_ERRORS = 4609,   2844     VG_USERREQ__COUNT_ERRORS = 4609,
2845     VG_USERREQ__MALLOCLIKE_BLOCK = 4865,   2845     VG_USERREQ__MALLOCLIKE_BLOCK = 4865,
2846     VG_USERREQ__FREELIKE_BLOCK = 4866,   2846     VG_USERREQ__FREELIKE_BLOCK = 4866,
2847     VG_USERREQ__CREATE_MEMPOOL = 4867,   2847     VG_USERREQ__CREATE_MEMPOOL = 4867,
2848     VG_USERREQ__DESTROY_MEMPOOL = 4868,   2848     VG_USERREQ__DESTROY_MEMPOOL = 4868,
2849     VG_USERREQ__MEMPOOL_ALLOC = 4869,   2849     VG_USERREQ__MEMPOOL_ALLOC = 4869,
2850     VG_USERREQ__MEMPOOL_FREE = 4870,   2850     VG_USERREQ__MEMPOOL_FREE = 4870,
2851     VG_USERREQ__MEMPOOL_TRIM = 4871,   2851     VG_USERREQ__MEMPOOL_TRIM = 4871,
2852     VG_USERREQ__MOVE_MEMPOOL = 4872,   2852     VG_USERREQ__MOVE_MEMPOOL = 4872,
2853     VG_USERREQ__MEMPOOL_CHANGE = 4873,   2853     VG_USERREQ__MEMPOOL_CHANGE = 4873,
2854     VG_USERREQ__MEMPOOL_EXISTS = 4874,   2854     VG_USERREQ__MEMPOOL_EXISTS = 4874,
2855     VG_USERREQ__PRINTF = 5121,   2855     VG_USERREQ__PRINTF = 5121,
2856     VG_USERREQ__PRINTF_BACKTRACE = 5122,   2856     VG_USERREQ__PRINTF_BACKTRACE = 5122,
2857     VG_USERREQ__PRINTF_VALIST_BY_REF = 5123,   2857     VG_USERREQ__PRINTF_VALIST_BY_REF = 5123,
2858     VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 5124,   2858     VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 5124,
2859     VG_USERREQ__STACK_REGISTER = 5377,   2859     VG_USERREQ__STACK_REGISTER = 5377,
2860     VG_USERREQ__STACK_DEREGISTER = 5378,   2860     VG_USERREQ__STACK_DEREGISTER = 5378,
2861     VG_USERREQ__STACK_CHANGE = 5379,   2861     VG_USERREQ__STACK_CHANGE = 5379,
2862     VG_USERREQ__LOAD_PDB_DEBUGINFO = 5633,   2862     VG_USERREQ__LOAD_PDB_DEBUGINFO = 5633,
2863     VG_USERREQ__MAP_IP_TO_SRCLOC = 5889   2863     VG_USERREQ__MAP_IP_TO_SRCLOC = 5889
2864 } ;   2864 } ;
2865 typedef enum __anonenum_Vg_ClientRequest_96 Vg_ClientRequest;   2865 typedef enum __anonenum_Vg_ClientRequest_96 Vg_ClientRequest;
2866 enum __anonenum_Vg_TCheckClientRequest_97 {   2866 enum __anonenum_Vg_TCheckClientRequest_97 {
2867     VG_USERREQ__HG_CLEAN_MEMORY = 1212612608,   2867     VG_USERREQ__HG_CLEAN_MEMORY = 1212612608,
2868     _VG_USERREQ__HG_SET_MY_PTHREAD_T = 1212612864,   2868     _VG_USERREQ__HG_SET_MY_PTHREAD_T = 1212612864,
2869     _VG_USERREQ__HG_PTH_API_ERROR = 1212612865,   2869     _VG_USERREQ__HG_PTH_API_ERROR = 1212612865,
2870     _VG_USERREQ__HG_PTHREAD_JOIN_POST = 1212612866,   2870     _VG_USERREQ__HG_PTHREAD_JOIN_POST = 1212612866,
2871     _VG_USERREQ__HG_PTHREAD_MUTEX_INIT_POST = 1212612867,   2871     _VG_USERREQ__HG_PTHREAD_MUTEX_INIT_POST = 1212612867,
2872     _VG_USERREQ__HG_PTHREAD_MUTEX_DESTROY_PRE = 1212612868,   2872     _VG_USERREQ__HG_PTHREAD_MUTEX_DESTROY_PRE = 1212612868,
2873     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_PRE = 1212612869,   2873     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_PRE = 1212612869,
2874     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_POST = 1212612870,   2874     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_POST = 1212612870,
2875     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_PRE = 1212612871,   2875     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_PRE = 1212612871,
2876     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_POST = 1212612872,   2876     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_POST = 1212612872,
2877     _VG_USERREQ__HG_PTHREAD_COND_SIGNAL_PRE = 1212612873,   2877     _VG_USERREQ__HG_PTHREAD_COND_SIGNAL_PRE = 1212612873,
2878     _VG_USERREQ__HG_PTHREAD_COND_BROADCAST_PRE = 1212612874,   2878     _VG_USERREQ__HG_PTHREAD_COND_BROADCAST_PRE = 1212612874,
2879     _VG_USERREQ__HG_PTHREAD_COND_WAIT_PRE = 1212612875,   2879     _VG_USERREQ__HG_PTHREAD_COND_WAIT_PRE = 1212612875,
2880     _VG_USERREQ__HG_PTHREAD_COND_WAIT_POST = 1212612876,   2880     _VG_USERREQ__HG_PTHREAD_COND_WAIT_POST = 1212612876,
2881     _VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE = 1212612877,   2881     _VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE = 1212612877,
2882     _VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST = 1212612878,   2882     _VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST = 1212612878,
2883     _VG_USERREQ__HG_PTHREAD_RWLOCK_DESTROY_PRE = 1212612879,   2883     _VG_USERREQ__HG_PTHREAD_RWLOCK_DESTROY_PRE = 1212612879,
2884     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE = 1212612880,   2884     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE = 1212612880,
2885     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST = 1212612881,   2885     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST = 1212612881,
2886     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_PRE = 1212612882,   2886     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_PRE = 1212612882,
2887     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_POST = 1212612883,   2887     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_POST = 1212612883,
2888     _VG_USERREQ__HG_POSIX_SEM_INIT_POST = 1212612884,   2888     _VG_USERREQ__HG_POSIX_SEM_INIT_POST = 1212612884,
2889     _VG_USERREQ__HG_POSIX_SEM_DESTROY_PRE = 1212612885,   2889     _VG_USERREQ__HG_POSIX_SEM_DESTROY_PRE = 1212612885,
2890     _VG_USERREQ__HG_POSIX_SEM_POST_PRE = 1212612886,   2890     _VG_USERREQ__HG_POSIX_SEM_POST_PRE = 1212612886,
2891     _VG_USERREQ__HG_POSIX_SEM_WAIT_POST = 1212612887,   2891     _VG_USERREQ__HG_POSIX_SEM_WAIT_POST = 1212612887,
2892     _VG_USERREQ__HG_PTHREAD_BARRIER_INIT_PRE = 1212612888,   2892     _VG_USERREQ__HG_PTHREAD_BARRIER_INIT_PRE = 1212612888,
2893     _VG_USERREQ__HG_PTHREAD_BARRIER_WAIT_PRE = 1212612889,   2893     _VG_USERREQ__HG_PTHREAD_BARRIER_WAIT_PRE = 1212612889,
2894     _VG_USERREQ__HG_PTHREAD_BARRIER_DESTROY_PRE = 1212612890,   2894     _VG_USERREQ__HG_PTHREAD_BARRIER_DESTROY_PRE = 1212612890,
2895     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE = 1212612891,   2895     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE = 1212612891,
2896     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST = 1212612892,   2896     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST = 1212612892,
2897     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_PRE = 1212612893,   2897     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_PRE = 1212612893,
2898     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_POST = 1212612894,   2898     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_POST = 1212612894,
2899     _VG_USERREQ__HG_PTHREAD_SPIN_DESTROY_PRE = 1212612895,   2899     _VG_USERREQ__HG_PTHREAD_SPIN_DESTROY_PRE = 1212612895,
2900     _VG_USERREQ__HG_CLIENTREQ_UNIMP = 1212612896,   2900     _VG_USERREQ__HG_CLIENTREQ_UNIMP = 1212612896,
2901     _VG_USERREQ__HG_USERSO_SEND_PRE = 1212612897,   2901     _VG_USERREQ__HG_USERSO_SEND_PRE = 1212612897,
2902     _VG_USERREQ__HG_USERSO_RECV_POST = 1212612898,   2902     _VG_USERREQ__HG_USERSO_RECV_POST = 1212612898,
2903     _VG_USERREQ__HG_RESERVED1 = 1212612899,   2903     _VG_USERREQ__HG_RESERVED1 = 1212612899,
2904     _VG_USERREQ__HG_RESERVED2 = 1212612900,   2904     _VG_USERREQ__HG_RESERVED2 = 1212612900,
2905     _VG_USERREQ__HG_RESERVED3 = 1212612901,   2905     _VG_USERREQ__HG_RESERVED3 = 1212612901,
2906     _VG_USERREQ__HG_RESERVED4 = 1212612902,   2906     _VG_USERREQ__HG_RESERVED4 = 1212612902,
2907     _VG_USERREQ__HG_ARANGE_MAKE_UNTRACKED = 1212612903,   2907     _VG_USERREQ__HG_ARANGE_MAKE_UNTRACKED = 1212612903,
2908     _VG_USERREQ__HG_ARANGE_MAKE_TRACKED = 1212612904,   2908     _VG_USERREQ__HG_ARANGE_MAKE_TRACKED = 1212612904,
2909     _VG_USERREQ__HG_PTHREAD_BARRIER_RESIZE_PRE = 1212612905,   2909     _VG_USERREQ__HG_PTHREAD_BARRIER_RESIZE_PRE = 1212612905,
2910     _VG_USERREQ__HG_CLEAN_MEMORY_HEAPBLOCK = 1212612906   2910     _VG_USERREQ__HG_CLEAN_MEMORY_HEAPBLOCK = 1212612906
2911 } ;   2911 } ;
2912 typedef enum __anonenum_Vg_TCheckClientRequest_97 Vg_TCheckClientRequest;   2912 typedef enum __anonenum_Vg_TCheckClientRequest_97 Vg_TCheckClientRequest;
2913 struct __anonstruct_CVInfo_98 {   2913 struct __anonstruct_CVInfo_98 {
2914    SO *so ;   2914    SO *so ;
2915    void *mx_ga ;   2915    void *mx_ga ;
2916    UWord nWaiters ;   2916    UWord nWaiters ;
2917 };   2917 };
2918 typedef struct __anonstruct_CVInfo_98 CVInfo;   2918 typedef struct __anonstruct_CVInfo_98 CVInfo;
2919 struct __anonstruct_Bar_99 {   2919 struct __anonstruct_Bar_99 {
2920    Bool initted ;   2920    Bool initted ;
2921    Bool resizable ;   2921    Bool resizable ;
2922    UWord size ;   2922    UWord size ;
2923    XArray *waiting ;   2923    XArray *waiting ;
2924 };   2924 };
2925 typedef struct __anonstruct_Bar_99 Bar;   2925 typedef struct __anonstruct_Bar_99 Bar;
2926 struct __anonstruct_LAOGLinks_100 {   2926 struct __anonstruct_LAOGLinks_100 {
2927    WordSetID inns ;   2927    WordSetID inns ;
2928    WordSetID outs ;   2928    WordSetID outs ;
2929 };   2929 };
2930 typedef struct __anonstruct_LAOGLinks_100 LAOGLinks;   2930 typedef struct __anonstruct_LAOGLinks_100 LAOGLinks;
2931 struct __anonstruct_LAOGLinkExposition_101 {   2931 struct __anonstruct_LAOGLinkExposition_101 {
2932    Addr src_ga ;   2932    Addr src_ga ;
2933    Addr dst_ga ;   2933    Addr dst_ga ;
2934    ExeContext *src_ec ;   2934    ExeContext *src_ec ;
2935    ExeContext *dst_ec ;   2935    ExeContext *dst_ec ;
2936 };   2936 };
2937 typedef struct __anonstruct_LAOGLinkExposition_101 LAOGLinkExposition;   2937 typedef struct __anonstruct_LAOGLinkExposition_101 LAOGLinkExposition;
2938 struct __anonstruct_MallocMeta_102 {   2938 struct __anonstruct_MallocMeta_102 {
2939    void *next ;   2939    void *next ;
2940    Addr payload ;   2940    Addr payload ;
2941    SizeT szB ;   2941    SizeT szB ;
2942    ExeContext *where ;   2942    ExeContext *where ;
2943    Thread *thr ;   2943    Thread *thr ;
2944 };   2944 };
2945 typedef struct __anonstruct_MallocMeta_102 MallocMeta;   2945 typedef struct __anonstruct_MallocMeta_102 MallocMeta;
2946 struct _MallocMeta;   2946 struct _MallocMeta;
2947 __inline static Bool toBool(Int x )   2947 __inline static Bool toBool(Int x )
2948 {   2948 {
2949   Int r ;   2949   Int r ;
2950   int tmp ;   2950   int tmp ;
2951     2951  
2952   {   2952   {
2953   if (x == 0) {   2953   if (x == 0) {
2954     tmp = (int )((Bool )0);   2954     tmp = (int )((Bool )0);
2955   } else {   2955   } else {
2956     tmp = (int )((Bool )1);   2956     tmp = (int )((Bool )1);
2957   }   2957   }
2958   r = tmp;   2958   r = tmp;
2959   return ((Bool )r);   2959   return ((Bool )r);
2960 }   2960 }
2961 }   2961 }
2962 __inline static UChar toUChar(Int x )   2962 __inline static UChar toUChar(Int x )
2963 {   2963 {
2964     2964  
2965     2965  
2966   {   2966   {
2967   x &= 255;   2967   x &= 255;
2968   return ((UChar )x);   2968   return ((UChar )x);
2969 }   2969 }
2970 }   2970 }
2971 __inline static HChar toHChar(Int x )   2971 __inline static HChar toHChar(Int x )
2972 {   2972 {
2973     2973  
2974     2974  
2975   {   2975   {
2976   x &= 255;   2976   x &= 255;
2977   return ((HChar )x);   2977   return ((HChar )x);
2978 }   2978 }
2979 }   2979 }
2980 __inline static UShort toUShort(Int x )   2980 __inline static UShort toUShort(Int x )
2981 {   2981 {
2982     2982  
2983     2983  
2984   {   2984   {
2985   x &= 65535;   2985   x &= 65535;
2986   return ((UShort )x);   2986   return ((UShort )x);
2987 }   2987 }
2988 }   2988 }
2989 __inline static Short toShort(Int x )   2989 __inline static Short toShort(Int x )
2990 {   2990 {
2991     2991  
2992     2992  
2993   {   2993   {
2994   x &= 65535;   2994   x &= 65535;
2995   return ((Short )x);   2995   return ((Short )x);
2996 }   2996 }
2997 }   2997 }
2998 __inline static UInt toUInt(Long x )   2998 __inline static UInt toUInt(Long x )
2999 {   2999 {
3000     3000  
3001     3001  
3002   {   3002   {
3003   x &= 4294967295LL;   3003   x &= 4294967295LL;
3004   return ((UInt )x);   3004   return ((UInt )x);
3005 }   3005 }
3006 }   3006 }
3007 __inline static ULong Ptr_to_ULong(void *p )   3007 __inline static ULong Ptr_to_ULong(void *p )
3008 {   3008 {
3009   UInt w ;   3009   UInt w ;
3010     3010  
3011   {   3011   {
3012   w = (UInt )p;   3012   w = (UInt )p;
3013   return ((ULong )w);   3013   return ((ULong )w);
3014 }   3014 }
3015 }   3015 }
3016 __inline static void *ULong_to_Ptr(ULong n )   3016 __inline static void *ULong_to_Ptr(ULong n )
3017 {   3017 {
3018   UInt w ;   3018   UInt w ;
3019     3019  
3020   {   3020   {
3021   w = (UInt )n;   3021   w = (UInt )n;
3022   return ((void *)w);   3022   return ((void *)w);
3023 }   3023 }
3024 }   3024 }
3025 __inline static Bool sr_isError(SysRes sr )   3025 __inline static Bool sr_isError(SysRes sr )
3026 {   3026 {
3027     3027  
3028     3028  
3029   {   3029   {
3030   return (sr._isError);   3030   return (sr._isError);
3031 }   3031 }
3032 }   3032 }
3033 __inline static UWord sr_Res(SysRes sr )   3033 __inline static UWord sr_Res(SysRes sr )
3034 {   3034 {
3035   UWord tmp ;   3035   UWord tmp ;
3036     3036  
3037   {   3037   {
3038   if (sr._isError) {   3038   if (sr._isError) {
3039     tmp = (UWord )0;   3039     tmp = (UWord )0;
3040   } else {   3040   } else {
3041     tmp = sr._val;   3041     tmp = sr._val;
3042   }   3042   }
3043   return (tmp);   3043   return (tmp);
3044 }   3044 }
3045 }   3045 }
3046 __inline static UWord sr_ResHI(SysRes sr )   3046 __inline static UWord sr_ResHI(SysRes sr )
3047 {   3047 {
3048     3048  
3049     3049  
3050   {   3050   {
3051   return ((UWord )0);   3051   return ((UWord )0);
3052 }   3052 }
3053 }   3053 }
3054 __inline static UWord sr_Err(SysRes sr )   3054 __inline static UWord sr_Err(SysRes sr )
3055 {   3055 {
3056   UWord tmp ;   3056   UWord tmp ;
3057     3057  
3058   {   3058   {
3059   if (sr._isError) {   3059   if (sr._isError) {
3060     tmp = sr._val;   3060     tmp = sr._val;
3061   } else {   3061   } else {
3062     tmp = (UWord )0;   3062     tmp = (UWord )0;
3063   }   3063   }
3064   return (tmp);   3064   return (tmp);
3065 }   3065 }
3066 }   3066 }
3067 __inline static Bool sr_EQ(SysRes sr1 , SysRes sr2 )   3067 __inline static Bool sr_EQ(SysRes sr1 , SysRes sr2 )
3068 {   3068 {
3069   int tmp ;   3069   int tmp ;
3070     3070  
3071   {   3071   {
3072   if (sr1._val == sr2._val) {   3072   if (sr1._val == sr2._val) {
3073     if (sr1._isError) {   3073     if (sr1._isError) {
3074       if (sr2._isError) {   3074       if (sr2._isError) {
3075         tmp = 1;   3075         tmp = 1;
3076       } else {   3076       } else {
3077         goto _L;   3077         goto _L;
3078       }   3078       }
3079     } else   3079     } else
3080     _L: /* CIL Label */   3080     _L: /* CIL Label */
3081     if (! sr1._isError) {   3081     if (! sr1._isError) {
3082       if (! sr2._isError) {   3082       if (! sr2._isError) {
3083         tmp = 1;   3083         tmp = 1;
3084       } else {   3084       } else {
3085         tmp = 0;   3085         tmp = 0;
3086       }   3086       }
3087     } else {   3087     } else {
3088       tmp = 0;   3088       tmp = 0;
3089     }   3089     }
3090   } else {   3090   } else {
3091     tmp = 0;   3091     tmp = 0;
3092   }   3092   }
3093   return ((Bool )tmp);   3093   return ((Bool )tmp);
3094 }   3094 }
3095 }   3095 }
3096 extern  __attribute__((__noreturn__)) void vgPlain_exit(Int status ) ;   3096 extern  __attribute__((__noreturn__)) void vgPlain_exit(Int status ) ;
3097 extern  __attribute__((__noreturn__)) void vgPlain_tool_panic(Char *str ) ;   3097 extern  __attribute__((__noreturn__)) void vgPlain_tool_panic(Char *str ) ;
3098 extern  __attribute__((__noreturn__)) void vgPlain_assert_fail(Bool isCore ,   3098 extern  __attribute__((__noreturn__)) void vgPlain_assert_fail(Bool isCore ,
3099                                                                Char const   *expr ,   3099                                                                Char const   *expr ,
3100                                                                Char const   *file ,   3100                                                                Char const   *file ,
3101                                                                Int line ,   3101                                                                Int line ,
3102                                                                Char const   *fn ,   3102                                                                Char const   *fn ,
3103                                                                HChar const   *format   3103                                                                HChar const   *format
3104                                                                , ...) ;   3104                                                                , ...) ;
3105 extern Bool vgPlain_isspace(Char c ) ;   3105 extern Bool vgPlain_isspace(Char c ) ;
3106 extern Bool vgPlain_isdigit(Char c ) ;   3106 extern Bool vgPlain_isdigit(Char c ) ;
3107 extern Char vgPlain_tolower(Char c ) ;   3107 extern Char vgPlain_tolower(Char c ) ;
3108 extern Long vgPlain_strtoll10(Char *str , Char **endptr ) ;   3108 extern Long vgPlain_strtoll10(Char *str , Char **endptr ) ;
3109 extern Long vgPlain_strtoll16(Char *str , Char **endptr ) ;   3109 extern Long vgPlain_strtoll16(Char *str , Char **endptr ) ;
3110 extern double vgPlain_strtod(Char *str , Char **endptr ) ;   3110 extern double vgPlain_strtod(Char *str , Char **endptr ) ;
3111 extern SizeT vgPlain_strlen(Char const   *str ) ;   3111 extern SizeT vgPlain_strlen(Char const   *str ) ;
3112 extern Char *vgPlain_strcat(Char *dest , Char const   *src ) ;   3112 extern Char *vgPlain_strcat(Char *dest , Char const   *src ) ;
3113 extern Char *vgPlain_strncat(Char *dest , Char const   *src , SizeT n ) ;   3113 extern Char *vgPlain_strncat(Char *dest , Char const   *src , SizeT n ) ;
3114 extern Char *vgPlain_strpbrk(Char const   *s , Char const   *accpt ) ;   3114 extern Char *vgPlain_strpbrk(Char const   *s , Char const   *accpt ) ;
3115 extern Char *vgPlain_strcpy(Char *dest , Char const   *src ) ;   3115 extern Char *vgPlain_strcpy(Char *dest , Char const   *src ) ;
3116 extern Char *vgPlain_strncpy(Char *dest , Char const   *src , SizeT ndest ) ;   3116 extern Char *vgPlain_strncpy(Char *dest , Char const   *src , SizeT ndest ) ;
3117 extern Int vgPlain_strcmp(Char const   *s1 , Char const   *s2 ) ;   3117 extern Int vgPlain_strcmp(Char const   *s1 , Char const   *s2 ) ;
3118 extern Int vgPlain_strcasecmp(Char const   *s1 , Char const   *s2 ) ;   3118 extern Int vgPlain_strcasecmp(Char const   *s1 , Char const   *s2 ) ;
3119 extern Int vgPlain_strncmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;   3119 extern Int vgPlain_strncmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;
3120 extern Int vgPlain_strncasecmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;   3120 extern Int vgPlain_strncasecmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;
3121 extern Char *vgPlain_strstr(Char const   *haystack , Char *needle ) ;   3121 extern Char *vgPlain_strstr(Char const   *haystack , Char *needle ) ;
3122 extern Char *vgPlain_strcasestr(Char const   *haystack , Char *needle ) ;   3122 extern Char *vgPlain_strcasestr(Char const   *haystack , Char *needle ) ;
3123 extern Char *vgPlain_strchr(Char const   *s , Char c ) ;   3123 extern Char *vgPlain_strchr(Char const   *s , Char c ) ;
3124 extern Char *vgPlain_strrchr(Char const   *s , Char c ) ;   3124 extern Char *vgPlain_strrchr(Char const   *s , Char c ) ;
3125 extern SizeT vgPlain_strspn(Char const   *s , Char const   *accpt ) ;   3125 extern SizeT vgPlain_strspn(Char const   *s , Char const   *accpt ) ;
3126 extern SizeT vgPlain_strcspn(Char const   *s , char const   *reject ) ;   3126 extern SizeT vgPlain_strcspn(Char const   *s , char const   *reject ) ;
3127 extern void vgPlain_strncpy_safely(Char *dest , Char const   *src , SizeT ndest ) ;   3127 extern void vgPlain_strncpy_safely(Char *dest , Char const   *src , SizeT ndest ) ;
3128 extern void *vgPlain_memcpy(void *d , void const   *s , SizeT sz ) ;   3128 extern void *vgPlain_memcpy(void *d , void const   *s , SizeT sz ) ;
3129 extern void *vgPlain_memmove(void *d , void const   *s , SizeT sz ) ;   3129 extern void *vgPlain_memmove(void *d , void const   *s , SizeT sz ) ;
3130 extern void *vgPlain_memset(void *s , Int c , SizeT sz ) ;   3130 extern void *vgPlain_memset(void *s , Int c , SizeT sz ) ;
3131 extern Int vgPlain_memcmp(void const   *s1 , void const   *s2 , SizeT n ) ;   3131 extern Int vgPlain_memcmp(void const   *s1 , void const   *s2 , SizeT n ) ;
3132 __inline static void ( __attribute__((__always_inline__)) vgPlain_bzero_inline)(void *s ,   3132 __inline static void ( __attribute__((__always_inline__)) vgPlain_bzero_inline)(void *s ,
3133                                                                                 SizeT sz )   3133                                                                                 SizeT sz )
3134 {   3134 {
3135   UWord *p ;   3135   UWord *p ;
3136   UWord tmp ;   3136   UWord tmp ;
3137   UWord tmp___0 ;   3137   UWord tmp___0 ;
3138   UWord tmp___1 ;   3138   UWord tmp___1 ;
3139   UWord tmp___2 ;   3139   UWord tmp___2 ;
3140   UWord tmp___3 ;   3140   UWord tmp___3 ;
3141   UWord tmp___4 ;   3141   UWord tmp___4 ;
3142   UWord tmp___5 ;   3142   UWord tmp___5 ;
3143   UWord tmp___6 ;   3143   UWord tmp___6 ;
3144   UWord tmp___7 ;   3144   UWord tmp___7 ;
3145   UWord tmp___8 ;   3145   UWord tmp___8 ;
3146   UWord tmp___9 ;   3146   UWord tmp___9 ;
3147   UWord tmp___10 ;   3147   UWord tmp___10 ;
3148   UWord tmp___11 ;   3148   UWord tmp___11 ;
3149   UWord tmp___12 ;   3149   UWord tmp___12 ;
3150   UWord tmp___13 ;   3150   UWord tmp___13 ;
3151   UWord tmp___14 ;   3151   UWord tmp___14 ;
3152   UWord tmp___15 ;   3152   UWord tmp___15 ;
3153   UWord tmp___16 ;   3153   UWord tmp___16 ;
3154   UWord tmp___17 ;   3154   UWord tmp___17 ;
3155   UWord tmp___18 ;   3155   UWord tmp___18 ;
3156   UWord tmp___19 ;   3156   UWord tmp___19 ;
3157   UWord tmp___20 ;   3157   UWord tmp___20 ;
3158   UWord tmp___21 ;   3158   UWord tmp___21 ;
3159   UWord tmp___22 ;   3159   UWord tmp___22 ;
3160   UWord tmp___23 ;   3160   UWord tmp___23 ;
3161   UWord tmp___24 ;   3161   UWord tmp___24 ;
3162   UWord tmp___25 ;   3162   UWord tmp___25 ;
3163   UWord tmp___26 ;   3163   UWord tmp___26 ;
3164   long tmp___27 ;   3164   long tmp___27 ;
3165   long tmp___28 ;   3165   long tmp___28 ;
3166     3166  
3167   {   3167   {
3168   tmp___27 = __builtin_expect((long )(! (! (0UL == (sz & (Addr )(sizeof(UWord ) - 1U))))),   3168   tmp___27 = __builtin_expect((long )(! (! (0UL == (sz & (Addr )(sizeof(UWord ) - 1U))))),
3169                               1L);   3169                               1L);
3170   if (tmp___27) {   3170   if (tmp___27) {
3171     tmp___28 = __builtin_expect((long )(! (! (0UL == ((Addr )s & (Addr )(sizeof(UWord ) - 1U))))),   3171     tmp___28 = __builtin_expect((long )(! (! (0UL == ((Addr )s & (Addr )(sizeof(UWord ) - 1U))))),
3172                                 1L);   3172                                 1L);
3173     if (tmp___28) {   3173     if (tmp___28) {
3174       p = (UWord *)s;   3174       p = (UWord *)s;
3175       switch (sz / (SizeT )sizeof(UWord )) {   3175       switch (sz / (SizeT )sizeof(UWord )) {
3176       case 8UL:   3176       case 8UL:
3177       tmp___5 = 0UL;   3177       tmp___5 = 0UL;
3178       *(p + 7) = tmp___5;   3178       *(p + 7) = tmp___5;
3179       tmp___4 = tmp___5;   3179       tmp___4 = tmp___5;
3180       *(p + 6) = tmp___4;   3180       *(p + 6) = tmp___4;
3181       tmp___3 = tmp___4;   3181       tmp___3 = tmp___4;
3182       *(p + 5) = tmp___3;   3182       *(p + 5) = tmp___3;
3183       tmp___2 = tmp___3;   3183       tmp___2 = tmp___3;
3184       *(p + 4) = tmp___2;   3184       *(p + 4) = tmp___2;
3185       tmp___1 = tmp___2;   3185       tmp___1 = tmp___2;
3186       *(p + 3) = tmp___1;   3186       *(p + 3) = tmp___1;
3187       tmp___0 = tmp___1;   3187       tmp___0 = tmp___1;
3188       *(p + 2) = tmp___0;   3188       *(p + 2) = tmp___0;
3189       tmp = tmp___0;   3189       tmp = tmp___0;
3190       *(p + 1) = tmp;   3190       *(p + 1) = tmp;
3191       *(p + 0) = tmp;   3191       *(p + 0) = tmp;
3192       return;   3192       return;
3193       case 7UL:   3193       case 7UL:
3194       tmp___11 = 0UL;   3194       tmp___11 = 0UL;
3195       *(p + 6) = tmp___11;   3195       *(p + 6) = tmp___11;
3196       tmp___10 = tmp___11;   3196       tmp___10 = tmp___11;
3197       *(p + 5) = tmp___10;   3197       *(p + 5) = tmp___10;
3198       tmp___9 = tmp___10;   3198       tmp___9 = tmp___10;
3199       *(p + 4) = tmp___9;   3199       *(p + 4) = tmp___9;
3200       tmp___8 = tmp___9;   3200       tmp___8 = tmp___9;
3201       *(p + 3) = tmp___8;   3201       *(p + 3) = tmp___8;
3202       tmp___7 = tmp___8;   3202       tmp___7 = tmp___8;
3203       *(p + 2) = tmp___7;   3203       *(p + 2) = tmp___7;
3204       tmp___6 = tmp___7;   3204       tmp___6 = tmp___7;
3205       *(p + 1) = tmp___6;   3205       *(p + 1) = tmp___6;
3206       *(p + 0) = tmp___6;   3206       *(p + 0) = tmp___6;
3207       return;   3207       return;
3208       case 6UL:   3208       case 6UL:
3209       tmp___16 = 0UL;   3209       tmp___16 = 0UL;
3210       *(p + 5) = tmp___16;   3210       *(p + 5) = tmp___16;
3211       tmp___15 = tmp___16;   3211       tmp___15 = tmp___16;
3212       *(p + 4) = tmp___15;   3212       *(p + 4) = tmp___15;
3213       tmp___14 = tmp___15;   3213       tmp___14 = tmp___15;
3214       *(p + 3) = tmp___14;   3214       *(p + 3) = tmp___14;
3215       tmp___13 = tmp___14;   3215       tmp___13 = tmp___14;
3216       *(p + 2) = tmp___13;   3216       *(p + 2) = tmp___13;
3217       tmp___12 = tmp___13;   3217       tmp___12 = tmp___13;
3218       *(p + 1) = tmp___12;   3218       *(p + 1) = tmp___12;
3219       *(p + 0) = tmp___12;   3219       *(p + 0) = tmp___12;
3220       return;   3220       return;
3221       case 5UL:   3221       case 5UL:
3222       tmp___20 = 0UL;   3222       tmp___20 = 0UL;
3223       *(p + 4) = tmp___20;   3223       *(p + 4) = tmp___20;
3224       tmp___19 = tmp___20;   3224       tmp___19 = tmp___20;
3225       *(p + 3) = tmp___19;   3225       *(p + 3) = tmp___19;
3226       tmp___18 = tmp___19;   3226       tmp___18 = tmp___19;
3227       *(p + 2) = tmp___18;   3227       *(p + 2) = tmp___18;
3228       tmp___17 = tmp___18;   3228       tmp___17 = tmp___18;
3229       *(p + 1) = tmp___17;   3229       *(p + 1) = tmp___17;
3230       *(p + 0) = tmp___17;   3230       *(p + 0) = tmp___17;
3231       return;   3231       return;
3232       case 4UL:   3232       case 4UL:
3233       tmp___23 = 0UL;   3233       tmp___23 = 0UL;
3234       *(p + 3) = tmp___23;   3234       *(p + 3) = tmp___23;
3235       tmp___22 = tmp___23;   3235       tmp___22 = tmp___23;
3236       *(p + 2) = tmp___22;   3236       *(p + 2) = tmp___22;
3237       tmp___21 = tmp___22;   3237       tmp___21 = tmp___22;
3238       *(p + 1) = tmp___21;   3238       *(p + 1) = tmp___21;
3239       *(p + 0) = tmp___21;   3239       *(p + 0) = tmp___21;
3240       return;   3240       return;
3241       case 3UL:   3241       case 3UL:
3242       tmp___25 = 0UL;   3242       tmp___25 = 0UL;
3243       *(p + 2) = tmp___25;   3243       *(p + 2) = tmp___25;
3244       tmp___24 = tmp___25;   3244       tmp___24 = tmp___25;
3245       *(p + 1) = tmp___24;   3245       *(p + 1) = tmp___24;
3246       *(p + 0) = tmp___24;   3246       *(p + 0) = tmp___24;
3247       return;   3247       return;
3248       case 2UL:   3248       case 2UL:
3249       tmp___26 = 0UL;   3249       tmp___26 = 0UL;
3250       *(p + 1) = tmp___26;   3250       *(p + 1) = tmp___26;
3251       *(p + 0) = tmp___26;   3251       *(p + 0) = tmp___26;
3252       return;   3252       return;
3253       case 1UL:   3253       case 1UL:
3254       *(p + 0) = 0UL;   3254       *(p + 0) = 0UL;
3255       return;   3255       return;
3256       case 0UL:   3256       case 0UL:
3257       return;   3257       return;
3258       default:   3258       default:
3259       break;   3259       break;
3260       }   3260       }
3261     } else {   3261     } else {
3262     3262  
3263     }   3263     }
3264   } else {   3264   } else {
3265     3265  
3266   }   3266   }
3267   vgPlain_memset(s, 0, sz);   3267   vgPlain_memset(s, 0, sz);
3268   return;   3268   return;
3269 }   3269 }
3270 }   3270 }
3271 extern void vgPlain_ssort(void *base , SizeT nmemb , SizeT size ,   3271 extern void vgPlain_ssort(void *base , SizeT nmemb , SizeT size ,
3272                           Int (*compar)(void * , void * ) ) ;   3272                           Int (*compar)(void * , void * ) ) ;
3273 extern Int vgPlain_log2(UInt x ) ;   3273 extern Int vgPlain_log2(UInt x ) ;
3274 extern UInt vgPlain_random(UInt *pSeed ) ;   3274 extern UInt vgPlain_random(UInt *pSeed ) ;
3275 extern UInt ( /* format attribute */  vgPlain_sprintf)(Char *buf ,   3275 extern UInt ( /* format attribute */  vgPlain_sprintf)(Char *buf ,
3276                                                        HChar const   *format   3276                                                        HChar const   *format
3277                                                        , ...) ;   3277                                                        , ...) ;
3278 extern UInt ( /* format attribute */  vgPlain_vsprintf)(Char *buf ,   3278 extern UInt ( /* format attribute */  vgPlain_vsprintf)(Char *buf ,
3279                                                         HChar const   *format ,   3279                                                         HChar const   *format ,
3280                                                         va_list vargs ) ;   3280                                                         va_list vargs ) ;
3281 extern UInt ( /* format attribute */  vgPlain_snprintf)(Char *buf , Int size ,   3281 extern UInt ( /* format attribute */  vgPlain_snprintf)(Char *buf , Int size ,
3282                                                         HChar const   *format   3282                                                         HChar const   *format
3283                                                         , ...) ;   3283                                                         , ...) ;
3284 extern UInt ( /* format attribute */  vgPlain_vsnprintf)(Char *buf , Int size ,   3284 extern UInt ( /* format attribute */  vgPlain_vsnprintf)(Char *buf , Int size ,
3285                                                          HChar const   *format ,   3285                                                          HChar const   *format ,
3286                                                          va_list vargs ) ;   3286                                                          va_list vargs ) ;
3287 extern void vgPlain_percentify(ULong n , ULong m , UInt d , Int n_buf ,   3287 extern void vgPlain_percentify(ULong n , ULong m , UInt d , Int n_buf ,
3288                                char *buf ) ;   3288                                char *buf ) ;
3289 extern UInt ( /* format attribute */  vgPlain_printf)(HChar const   *format   3289 extern UInt ( /* format attribute */  vgPlain_printf)(HChar const   *format
3290                                                       , ...) ;   3290                                                       , ...) ;
3291 extern UInt ( /* format attribute */  vgPlain_vprintf)(HChar const   *format ,   3291 extern UInt ( /* format attribute */  vgPlain_vprintf)(HChar const   *format ,
3292                                                        va_list vargs ) ;   3292                                                        va_list vargs ) ;
3293 extern UInt ( /* format attribute */  vgPlain_printf_xml)(HChar const   *format   3293 extern UInt ( /* format attribute */  vgPlain_printf_xml)(HChar const   *format
3294                                                           , ...) ;   3294                                                           , ...) ;
3295 extern UInt ( /* format attribute */  vgPlain_vprintf_xml)(HChar const   *format ,   3295 extern UInt ( /* format attribute */  vgPlain_vprintf_xml)(HChar const   *format ,
3296                                                            va_list vargs ) ;   3296                                                            va_list vargs ) ;
3297 extern UInt vgPlain_printf_xml_no_f_c(HChar const   *format  , ...) ;   3297 extern UInt vgPlain_printf_xml_no_f_c(HChar const   *format  , ...) ;
3298 extern void vgPlain_vcbprintf(void (*char_sink)(HChar  , void *opaque ) ,   3298 extern void vgPlain_vcbprintf(void (*char_sink)(HChar  , void *opaque ) ,
3299                               void *opaque , HChar const   *format ,   3299                               void *opaque , HChar const   *format ,
3300                               va_list vargs ) ;   3300                               va_list vargs ) ;
3301 extern UInt vgPlain_message_no_f_c(VgMsgKind kind , HChar const   *format  , ...) ;   3301 extern UInt vgPlain_message_no_f_c(VgMsgKind kind , HChar const   *format  , ...) ;
3302 extern UInt ( /* format attribute */  vgPlain_message)(VgMsgKind kind ,   3302 extern UInt ( /* format attribute */  vgPlain_message)(VgMsgKind kind ,
3303                                                        HChar const   *format   3303                                                        HChar const   *format
3304                                                        , ...) ;   3304                                                        , ...) ;
3305 extern UInt ( /* format attribute */  vgPlain_vmessage)(VgMsgKind kind ,   3305 extern UInt ( /* format attribute */  vgPlain_vmessage)(VgMsgKind kind ,
3306                                                         HChar const   *format ,   3306                                                         HChar const   *format ,
3307                                                         va_list vargs ) ;   3307                                                         va_list vargs ) ;
3308 extern UInt ( /* format attribute */  vgPlain_fmsg)(HChar const   *format  , ...) ;   3308 extern UInt ( /* format attribute */  vgPlain_fmsg)(HChar const   *format  , ...) ;
3309 extern  __attribute__((__noreturn__)) void ( /* format attribute */  vgPlain_fmsg_bad_option)(HChar *opt ,   3309 extern  __attribute__((__noreturn__)) void ( /* format attribute */  vgPlain_fmsg_bad_option)(HChar *opt ,
3310                                                                                               HChar const   *format   3310                                                                                               HChar const   *format
3311                                                                                               , ...) ;   3311                                                                                               , ...) ;
3312 extern UInt ( /* format attribute */  vgPlain_umsg)(HChar const   *format  , ...) ;   3312 extern UInt ( /* format attribute */  vgPlain_umsg)(HChar const   *format  , ...) ;
3313 extern UInt ( /* format attribute */  vgPlain_dmsg)(HChar const   *format  , ...) ;   3313 extern UInt ( /* format attribute */  vgPlain_dmsg)(HChar const   *format  , ...) ;
3314 extern void vgPlain_message_flush(void) ;   3314 extern void vgPlain_message_flush(void) ;
3315 extern ThreadId vgPlain_get_running_tid(void) ;   3315 extern ThreadId vgPlain_get_running_tid(void) ;
3316 extern ExeContext *vgPlain_record_ExeContext(ThreadId tid , Word first_ip_delta ) ;   3316 extern ExeContext *vgPlain_record_ExeContext(ThreadId tid , Word first_ip_delta ) ;
3317 extern ExeContext *vgPlain_record_depth_1_ExeContext(ThreadId tid ) ;   3317 extern ExeContext *vgPlain_record_depth_1_ExeContext(ThreadId tid ) ;
3318 extern void vgPlain_apply_ExeContext(void (*action)(UInt n , Addr ip ) ,   3318 extern void vgPlain_apply_ExeContext(void (*action)(UInt n , Addr ip ) ,
3319                                      ExeContext *ec , UInt n_ips ) ;   3319                                      ExeContext *ec , UInt n_ips ) ;
3320 extern Bool vgPlain_eq_ExeContext(VgRes res , ExeContext *e1 , ExeContext *e2 ) ;   3320 extern Bool vgPlain_eq_ExeContext(VgRes res , ExeContext *e1 , ExeContext *e2 ) ;
3321 extern void vgPlain_pp_ExeContext(ExeContext *ec ) ;   3321 extern void vgPlain_pp_ExeContext(ExeContext *ec ) ;
3322 extern UInt vgPlain_get_ECU_from_ExeContext(ExeContext *e ) ;   3322 extern UInt vgPlain_get_ECU_from_ExeContext(ExeContext *e ) ;
3323 extern Int vgPlain_get_ExeContext_n_ips(ExeContext *e ) ;   3323 extern Int vgPlain_get_ExeContext_n_ips(ExeContext *e ) ;
3324 extern ExeContext *vgPlain_get_ExeContext_from_ECU(UInt uniq ) ;   3324 extern ExeContext *vgPlain_get_ExeContext_from_ECU(UInt uniq ) ;
3325 extern ExeContext *vgPlain_make_depth_1_ExeContext_from_Addr(Addr a ) ;   3325 extern ExeContext *vgPlain_make_depth_1_ExeContext_from_Addr(Addr a ) ;
3326 __inline static Bool vgPlain_is_plausible_ECU(UInt ecu )   3326 __inline static Bool vgPlain_is_plausible_ECU(UInt ecu )
3327 {   3327 {
3328   int tmp ;   3328   int tmp ;
3329     3329  
3330   {   3330   {
3331   if (ecu > 0U) {   3331   if (ecu > 0U) {
3332     if ((ecu & 3U) == 0U) {   3332     if ((ecu & 3U) == 0U) {
3333       tmp = 1;   3333       tmp = 1;
3334     } else {   3334     } else {
3335       tmp = 0;   3335       tmp = 0;
3336     }   3336     }
3337   } else {   3337   } else {
3338     tmp = 0;   3338     tmp = 0;
3339   }   3339   }
3340   return ((Bool )tmp);   3340   return ((Bool )tmp);
3341 }   3341 }
3342 }   3342 }
3343 extern ExeContext *vgPlain_make_ExeContext_from_StackTrace(Addr *ips ,   3343 extern ExeContext *vgPlain_make_ExeContext_from_StackTrace(Addr *ips ,
3344                                                            UInt n_ips ) ;   3344                                                            UInt n_ips ) ;
3345 extern ExeContext *vgPlain_get_error_where(Error *err ) ;   3345 extern ExeContext *vgPlain_get_error_where(Error *err ) ;
3346 extern ErrorKind vgPlain_get_error_kind(Error *err ) ;   3346 extern ErrorKind vgPlain_get_error_kind(Error *err ) ;
3347 extern Addr vgPlain_get_error_address(Error *err ) ;   3347 extern Addr vgPlain_get_error_address(Error *err ) ;
3348 extern Char *vgPlain_get_error_string(Error *err ) ;   3348 extern Char *vgPlain_get_error_string(Error *err ) ;
3349 extern void *vgPlain_get_error_extra(Error *err ) ;   3349 extern void *vgPlain_get_error_extra(Error *err ) ;
3350 extern void vgPlain_maybe_record_error(ThreadId tid , ErrorKind ekind , Addr a ,   3350 extern void vgPlain_maybe_record_error(ThreadId tid , ErrorKind ekind , Addr a ,
3351                                        Char *s , void *extra ) ;   3351                                        Char *s , void *extra ) ;
3352 extern Bool vgPlain_unique_error(ThreadId tid , ErrorKind ekind , Addr a ,   3352 extern Bool vgPlain_unique_error(ThreadId tid , ErrorKind ekind , Addr a ,
3353                                  Char *s , void *extra , ExeContext *where ,   3353                                  Char *s , void *extra , ExeContext *where ,
3354                                  Bool print_error , Bool allow_GDB_attach ,   3354                                  Bool print_error , Bool allow_GDB_attach ,
3355                                  Bool count_error ) ;   3355                                  Bool count_error ) ;
3356 extern Bool vgPlain_get_line(Int fd , Char **bufpp , SizeT *nBufp , Int *lineno ) ;   3356 extern Bool vgPlain_get_line(Int fd , Char **bufpp , SizeT *nBufp , Int *lineno ) ;
3357 extern SuppKind vgPlain_get_supp_kind(Supp *su ) ;   3357 extern SuppKind vgPlain_get_supp_kind(Supp *su ) ;
3358 extern Char *vgPlain_get_supp_string(Supp *su ) ;   3358 extern Char *vgPlain_get_supp_string(Supp *su ) ;
3359 extern void *vgPlain_get_supp_extra(Supp *su ) ;   3359 extern void *vgPlain_get_supp_extra(Supp *su ) ;
3360 extern void vgPlain_set_supp_kind(Supp *su , SuppKind suppkind ) ;   3360 extern void vgPlain_set_supp_kind(Supp *su , SuppKind suppkind ) ;
3361 extern void vgPlain_set_supp_string(Supp *su , Char *string ) ;   3361 extern void vgPlain_set_supp_string(Supp *su , Char *string ) ;
3362 extern void vgPlain_set_supp_extra(Supp *su , void *extra ) ;   3362 extern void vgPlain_set_supp_extra(Supp *su , void *extra ) ;
3363 extern void ppIRType(IRType  ) ;   3363 extern void ppIRType(IRType  ) ;
3364 extern Int sizeofIRType(IRType  ) ;   3364 extern Int sizeofIRType(IRType  ) ;
3365 extern IRConst *IRConst_U1(Bool  ) ;   3365 extern IRConst *IRConst_U1(Bool  ) ;
3366 extern IRConst *IRConst_U8(UChar  ) ;   3366 extern IRConst *IRConst_U8(UChar  ) ;
3367 extern IRConst *IRConst_U16(UShort  ) ;   3367 extern IRConst *IRConst_U16(UShort  ) ;
3368 extern IRConst *IRConst_U32(UInt  ) ;   3368 extern IRConst *IRConst_U32(UInt  ) ;
3369 extern IRConst *IRConst_U64(ULong  ) ;   3369 extern IRConst *IRConst_U64(ULong  ) ;
3370 extern IRConst *IRConst_F32(Float  ) ;   3370 extern IRConst *IRConst_F32(Float  ) ;
3371 extern IRConst *IRConst_F32i(UInt  ) ;   3371 extern IRConst *IRConst_F32i(UInt  ) ;
3372 extern IRConst *IRConst_F64(Double  ) ;   3372 extern IRConst *IRConst_F64(Double  ) ;
3373 extern IRConst *IRConst_F64i(ULong  ) ;   3373 extern IRConst *IRConst_F64i(ULong  ) ;
3374 extern IRConst *IRConst_V128(UShort  ) ;   3374 extern IRConst *IRConst_V128(UShort  ) ;
3375 extern IRConst *deepCopyIRConst(IRConst * ) ;   3375 extern IRConst *deepCopyIRConst(IRConst * ) ;
3376 extern void ppIRConst(IRConst * ) ;   3376 extern void ppIRConst(IRConst * ) ;
3377 extern Bool eqIRConst(IRConst * , IRConst * ) ;   3377 extern Bool eqIRConst(IRConst * , IRConst * ) ;
3378 extern IRCallee *mkIRCallee(Int regparms , HChar *name , void *addr ) ;   3378 extern IRCallee *mkIRCallee(Int regparms , HChar *name , void *addr ) ;
3379 extern IRCallee *deepCopyIRCallee(IRCallee * ) ;   3379 extern IRCallee *deepCopyIRCallee(IRCallee * ) ;
3380 extern void ppIRCallee(IRCallee * ) ;   3380 extern void ppIRCallee(IRCallee * ) ;
3381 extern IRRegArray *mkIRRegArray(Int  , IRType  , Int  ) ;   3381 extern IRRegArray *mkIRRegArray(Int  , IRType  , Int  ) ;
3382 extern IRRegArray *deepCopyIRRegArray(IRRegArray * ) ;   3382 extern IRRegArray *deepCopyIRRegArray(IRRegArray * ) ;
3383 extern void ppIRRegArray(IRRegArray * ) ;   3383 extern void ppIRRegArray(IRRegArray * ) ;
3384 extern Bool eqIRRegArray(IRRegArray * , IRRegArray * ) ;   3384 extern Bool eqIRRegArray(IRRegArray * , IRRegArray * ) ;
3385 extern void ppIRTemp(IRTemp  ) ;   3385 extern void ppIRTemp(IRTemp  ) ;
3386 extern void ppIROp(IROp  ) ;   3386 extern void ppIROp(IROp  ) ;
3387 extern IRExpr *IRExpr_Binder(Int binder ) ;   3387 extern IRExpr *IRExpr_Binder(Int binder ) ;
3388 extern IRExpr *IRExpr_Get(Int off , IRType ty ) ;   3388 extern IRExpr *IRExpr_Get(Int off , IRType ty ) ;
3389 extern IRExpr *IRExpr_GetI(IRRegArray *descr , IRExpr *ix , Int bias ) ;   3389 extern IRExpr *IRExpr_GetI(IRRegArray *descr , IRExpr *ix , Int bias ) ;
3390 extern IRExpr *IRExpr_RdTmp(IRTemp tmp ) ;   3390 extern IRExpr *IRExpr_RdTmp(IRTemp tmp ) ;
3391 extern IRExpr *IRExpr_Qop(IROp op , IRExpr *arg1 , IRExpr *arg2 , IRExpr *arg3 ,   3391 extern IRExpr *IRExpr_Qop(IROp op , IRExpr *arg1 , IRExpr *arg2 , IRExpr *arg3 ,
3392                           IRExpr *arg4 ) ;   3392                           IRExpr *arg4 ) ;
3393 extern IRExpr *IRExpr_Triop(IROp op , IRExpr *arg1 , IRExpr *arg2 ,   3393 extern IRExpr *IRExpr_Triop(IROp op , IRExpr *arg1 , IRExpr *arg2 ,
3394                             IRExpr *arg3 ) ;   3394                             IRExpr *arg3 ) ;
3395 extern IRExpr *IRExpr_Binop(IROp op , IRExpr *arg1 , IRExpr *arg2 ) ;   3395 extern IRExpr *IRExpr_Binop(IROp op , IRExpr *arg1 , IRExpr *arg2 ) ;
3396 extern IRExpr *IRExpr_Unop(IROp op , IRExpr *arg ) ;   3396 extern IRExpr *IRExpr_Unop(IROp op , IRExpr *arg ) ;
3397 extern IRExpr *IRExpr_Load(IREndness end , IRType ty , IRExpr *addr ) ;   3397 extern IRExpr *IRExpr_Load(IREndness end , IRType ty , IRExpr *addr ) ;
3398 extern IRExpr *IRExpr_Const(IRConst *con ) ;   3398 extern IRExpr *IRExpr_Const(IRConst *con ) ;
3399 extern IRExpr *IRExpr_CCall(IRCallee *cee , IRType retty , IRExpr **args ) ;   3399 extern IRExpr *IRExpr_CCall(IRCallee *cee , IRType retty , IRExpr **args ) ;
3400 extern IRExpr *IRExpr_Mux0X(IRExpr *cond , IRExpr *expr0 , IRExpr *exprX ) ;   3400 extern IRExpr *IRExpr_Mux0X(IRExpr *cond , IRExpr *expr0 , IRExpr *exprX ) ;
3401 extern IRExpr *deepCopyIRExpr(IRExpr * ) ;   3401 extern IRExpr *deepCopyIRExpr(IRExpr * ) ;
3402 extern void ppIRExpr(IRExpr * ) ;   3402 extern void ppIRExpr(IRExpr * ) ;
3403 extern IRExpr **mkIRExprVec_0(void) ;   3403 extern IRExpr **mkIRExprVec_0(void) ;
3404 extern IRExpr **mkIRExprVec_1(IRExpr * ) ;   3404 extern IRExpr **mkIRExprVec_1(IRExpr * ) ;
3405 extern IRExpr **mkIRExprVec_2(IRExpr * , IRExpr * ) ;   3405 extern IRExpr **mkIRExprVec_2(IRExpr * , IRExpr * ) ;
3406 extern IRExpr **mkIRExprVec_3(IRExpr * , IRExpr * , IRExpr * ) ;   3406 extern IRExpr **mkIRExprVec_3(IRExpr * , IRExpr * , IRExpr * ) ;
3407 extern IRExpr **mkIRExprVec_4(IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;   3407 extern IRExpr **mkIRExprVec_4(IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;
3408 extern IRExpr **mkIRExprVec_5(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3408 extern IRExpr **mkIRExprVec_5(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3409                               IRExpr * ) ;   3409                               IRExpr * ) ;
3410 extern IRExpr **mkIRExprVec_6(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3410 extern IRExpr **mkIRExprVec_6(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3411                               IRExpr * , IRExpr * ) ;   3411                               IRExpr * , IRExpr * ) ;
3412 extern IRExpr **mkIRExprVec_7(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3412 extern IRExpr **mkIRExprVec_7(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3413                               IRExpr * , IRExpr * , IRExpr * ) ;   3413                               IRExpr * , IRExpr * , IRExpr * ) ;
3414 extern IRExpr **mkIRExprVec_8(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3414 extern IRExpr **mkIRExprVec_8(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3415                               IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;   3415                               IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;
3416 extern IRExpr **shallowCopyIRExprVec(IRExpr ** ) ;   3416 extern IRExpr **shallowCopyIRExprVec(IRExpr ** ) ;
3417 extern IRExpr **deepCopyIRExprVec(IRExpr ** ) ;   3417 extern IRExpr **deepCopyIRExprVec(IRExpr ** ) ;
3418 extern IRExpr *mkIRExpr_HWord(HWord  ) ;   3418 extern IRExpr *mkIRExpr_HWord(HWord  ) ;
3419 extern IRExpr *mkIRExprCCall(IRType retty , Int regparms , HChar *name ,   3419 extern IRExpr *mkIRExprCCall(IRType retty , Int regparms , HChar *name ,
3420                              void *addr , IRExpr **args ) ;   3420                              void *addr , IRExpr **args ) ;
3421 __inline static Bool isIRAtom(IRExpr *e )   3421 __inline static Bool isIRAtom(IRExpr *e )
3422 {   3422 {
3423   int tmp ;   3423   int tmp ;
3424   Bool tmp___0 ;   3424   Bool tmp___0 ;
3425     3425  
3426   {   3426   {
3427   if ((unsigned int )e->tag == 86019U) {   3427   if ((unsigned int )e->tag == 86019U) {
3428     tmp = 1;   3428     tmp = 1;
3429   } else   3429   } else
3430   if ((unsigned int )e->tag == 86025U) {   3430   if ((unsigned int )e->tag == 86025U) {
3431     tmp = 1;   3431     tmp = 1;
3432   } else {   3432   } else {
3433     tmp = 0;   3433     tmp = 0;
3434   }   3434   }
3435   tmp___0 = toBool(tmp);   3435   tmp___0 = toBool(tmp);
3436   return (tmp___0);   3436   return (tmp___0);
3437 }   3437 }
3438 }   3438 }
3439 extern Bool eqIRAtom(IRExpr * , IRExpr * ) ;   3439 extern Bool eqIRAtom(IRExpr * , IRExpr * ) ;
3440 extern void ppIRJumpKind(IRJumpKind  ) ;   3440 extern void ppIRJumpKind(IRJumpKind  ) ;
3441 extern void ppIREffect(IREffect  ) ;   3441 extern void ppIREffect(IREffect  ) ;
3442 extern void ppIRDirty(IRDirty * ) ;   3442 extern void ppIRDirty(IRDirty * ) ;
3443 extern IRDirty *emptyIRDirty(void) ;   3443 extern IRDirty *emptyIRDirty(void) ;
3444 extern IRDirty *deepCopyIRDirty(IRDirty * ) ;   3444 extern IRDirty *deepCopyIRDirty(IRDirty * ) ;
3445 extern IRDirty *unsafeIRDirty_0_N(Int regparms , HChar *name , void *addr ,   3445 extern IRDirty *unsafeIRDirty_0_N(Int regparms , HChar *name , void *addr ,
3446                                   IRExpr **args ) ;   3446                                   IRExpr **args ) ;
3447 extern IRDirty *unsafeIRDirty_1_N(IRTemp dst , Int regparms , HChar *name ,   3447 extern IRDirty *unsafeIRDirty_1_N(IRTemp dst , Int regparms , HChar *name ,
3448                                   void *addr , IRExpr **args ) ;   3448                                   void *addr , IRExpr **args ) ;
3449 extern void ppIRMBusEvent(IRMBusEvent  ) ;   3449 extern void ppIRMBusEvent(IRMBusEvent  ) ;
3450 extern void ppIRCAS(IRCAS *cas ) ;   3450 extern void ppIRCAS(IRCAS *cas ) ;
3451 extern IRCAS *mkIRCAS(IRTemp oldHi , IRTemp oldLo , IREndness end ,   3451 extern IRCAS *mkIRCAS(IRTemp oldHi , IRTemp oldLo , IREndness end ,
3452                       IRExpr *addr , IRExpr *expdHi , IRExpr *expdLo ,   3452                       IRExpr *addr , IRExpr *expdHi , IRExpr *expdLo ,
3453                       IRExpr *dataHi , IRExpr *dataLo ) ;   3453                       IRExpr *dataHi , IRExpr *dataLo ) ;
3454 extern IRCAS *deepCopyIRCAS(IRCAS * ) ;   3454 extern IRCAS *deepCopyIRCAS(IRCAS * ) ;
3455 extern IRStmt *IRStmt_NoOp(void) ;   3455 extern IRStmt *IRStmt_NoOp(void) ;
3456 extern IRStmt *IRStmt_IMark(Addr64 addr , Int len ) ;   3456 extern IRStmt *IRStmt_IMark(Addr64 addr , Int len ) ;
3457 extern IRStmt *IRStmt_AbiHint(IRExpr *base , Int len , IRExpr *nia ) ;   3457 extern IRStmt *IRStmt_AbiHint(IRExpr *base , Int len , IRExpr *nia ) ;
3458 extern IRStmt *IRStmt_Put(Int off , IRExpr *data ) ;   3458 extern IRStmt *IRStmt_Put(Int off , IRExpr *data ) ;
3459 extern IRStmt *IRStmt_PutI(IRRegArray *descr , IRExpr *ix , Int bias ,   3459 extern IRStmt *IRStmt_PutI(IRRegArray *descr , IRExpr *ix , Int bias ,
3460                            IRExpr *data ) ;   3460                            IRExpr *data ) ;
3461 extern IRStmt *IRStmt_WrTmp(IRTemp tmp , IRExpr *data ) ;   3461 extern IRStmt *IRStmt_WrTmp(IRTemp tmp , IRExpr *data ) ;
3462 extern IRStmt *IRStmt_Store(IREndness end , IRExpr *addr , IRExpr *data ) ;   3462 extern IRStmt *IRStmt_Store(IREndness end , IRExpr *addr , IRExpr *data ) ;
3463 extern IRStmt *IRStmt_CAS(IRCAS *details ) ;   3463 extern IRStmt *IRStmt_CAS(IRCAS *details ) ;
3464 extern IRStmt *IRStmt_LLSC(IREndness end , IRTemp result , IRExpr *addr ,   3464 extern IRStmt *IRStmt_LLSC(IREndness end , IRTemp result , IRExpr *addr ,
3465                            IRExpr *storedata ) ;   3465                            IRExpr *storedata ) ;
3466 extern IRStmt *IRStmt_Dirty(IRDirty *details ) ;   3466 extern IRStmt *IRStmt_Dirty(IRDirty *details ) ;
3467 extern IRStmt *IRStmt_MBE(IRMBusEvent event ) ;   3467 extern IRStmt *IRStmt_MBE(IRMBusEvent event ) ;
3468 extern IRStmt *IRStmt_Exit(IRExpr *guard , IRJumpKind jk , IRConst *dst ) ;   3468 extern IRStmt *IRStmt_Exit(IRExpr *guard , IRJumpKind jk , IRConst *dst ) ;
3469 extern IRStmt *deepCopyIRStmt(IRStmt * ) ;   3469 extern IRStmt *deepCopyIRStmt(IRStmt * ) ;
3470 extern void ppIRStmt(IRStmt * ) ;   3470 extern void ppIRStmt(IRStmt * ) ;
3471 extern IRTemp newIRTemp(IRTypeEnv * , IRType  ) ;   3471 extern IRTemp newIRTemp(IRTypeEnv * , IRType  ) ;
3472 extern IRTypeEnv *deepCopyIRTypeEnv(IRTypeEnv * ) ;   3472 extern IRTypeEnv *deepCopyIRTypeEnv(IRTypeEnv * ) ;
3473 extern void ppIRTypeEnv(IRTypeEnv * ) ;   3473 extern void ppIRTypeEnv(IRTypeEnv * ) ;
3474 extern IRSB *emptyIRSB(void) ;   3474 extern IRSB *emptyIRSB(void) ;
3475 extern IRSB *deepCopyIRSB(IRSB * ) ;   3475 extern IRSB *deepCopyIRSB(IRSB * ) ;
3476 extern IRSB *deepCopyIRSBExceptStmts(IRSB * ) ;   3476 extern IRSB *deepCopyIRSBExceptStmts(IRSB * ) ;
3477 extern void ppIRSB(IRSB * ) ;   3477 extern void ppIRSB(IRSB * ) ;
3478 extern void addStmtToIRSB(IRSB * , IRStmt * ) ;   3478 extern void addStmtToIRSB(IRSB * , IRStmt * ) ;
3479 extern IRTypeEnv *emptyIRTypeEnv(void) ;   3479 extern IRTypeEnv *emptyIRTypeEnv(void) ;
3480 extern IRType typeOfIRConst(IRConst * ) ;   3480 extern IRType typeOfIRConst(IRConst * ) ;
3481 extern IRType typeOfIRTemp(IRTypeEnv * , IRTemp  ) ;   3481 extern IRType typeOfIRTemp(IRTypeEnv * , IRTemp  ) ;
3482 extern IRType typeOfIRExpr(IRTypeEnv * , IRExpr * ) ;   3482 extern IRType typeOfIRExpr(IRTypeEnv * , IRExpr * ) ;
3483 extern void sanityCheckIRSB(IRSB *bb , HChar *caller , Bool require_flatness ,   3483 extern void sanityCheckIRSB(IRSB *bb , HChar *caller , Bool require_flatness ,
3484                             IRType guest_word_size ) ;   3484                             IRType guest_word_size ) ;
3485 extern Bool isFlatIRStmt(IRStmt * ) ;   3485 extern Bool isFlatIRStmt(IRStmt * ) ;
3486 extern Bool isPlausibleIRType(IRType ty ) ;   3486 extern Bool isPlausibleIRType(IRType ty ) ;
3487 extern HChar const   *LibVEX_ppVexArch(VexArch  ) ;   3487 extern HChar const   *LibVEX_ppVexArch(VexArch  ) ;
3488 extern HChar const   *LibVEX_ppVexHwCaps(VexArch  , UInt  ) ;   3488 extern HChar const   *LibVEX_ppVexHwCaps(VexArch  , UInt  ) ;
3489 extern void LibVEX_default_VexArchInfo(VexArchInfo *vai ) ;   3489 extern void LibVEX_default_VexArchInfo(VexArchInfo *vai ) ;
3490 extern void LibVEX_default_VexAbiInfo(VexAbiInfo *vbi ) ;   3490 extern void LibVEX_default_VexAbiInfo(VexAbiInfo *vbi ) ;
3491 extern void LibVEX_default_VexControl(VexControl *vcon ) ;   3491 extern void LibVEX_default_VexControl(VexControl *vcon ) ;
3492 extern HChar *private_LibVEX_alloc_first ;   3492 extern HChar *private_LibVEX_alloc_first ;
3493 extern HChar *private_LibVEX_alloc_curr ;   3493 extern HChar *private_LibVEX_alloc_curr ;
3494 extern HChar *private_LibVEX_alloc_last ;   3494 extern HChar *private_LibVEX_alloc_last ;
3495 extern  __attribute__((__noreturn__)) void private_LibVEX_alloc_OOM(void) ;   3495 extern  __attribute__((__noreturn__)) void private_LibVEX_alloc_OOM(void) ;
3496 __inline static void *LibVEX_Alloc(Int nbytes )   3496 __inline static void *LibVEX_Alloc(Int nbytes )
3497 {   3497 {
3498   HChar *curr ;   3498   HChar *curr ;
3499   HChar *next ;   3499   HChar *next ;
3500   Int ALIGN ;   3500   Int ALIGN ;
3501     3501  
3502   {   3502   {
3503   ALIGN = (Int )(sizeof(void *) - 1U);   3503   ALIGN = (Int )(sizeof(void *) - 1U);
3504   nbytes = (nbytes + ALIGN) & ~ ALIGN;   3504   nbytes = (nbytes + ALIGN) & ~ ALIGN;
3505   curr = private_LibVEX_alloc_curr;   3505   curr = private_LibVEX_alloc_curr;
3506   next = curr + nbytes;   3506   next = curr + nbytes;
3507   if ((unsigned int )next >= (unsigned int )private_LibVEX_alloc_last) {   3507   if ((unsigned int )next >= (unsigned int )private_LibVEX_alloc_last) {
3508     private_LibVEX_alloc_OOM();   3508     private_LibVEX_alloc_OOM();
3509   } else {   3509   } else {
3510     3510  
3511   }   3511   }
3512   private_LibVEX_alloc_curr = next;   3512   private_LibVEX_alloc_curr = next;
3513   return ((void *)curr);   3513   return ((void *)curr);
3514 }   3514 }
3515 }   3515 }
3516 extern void LibVEX_ShowAllocStats(void) ;   3516 extern void LibVEX_ShowAllocStats(void) ;
3517 extern void LibVEX_Init( __attribute__((__noreturn__)) void (*failure_exit)(void) ,   3517 extern void LibVEX_Init( __attribute__((__noreturn__)) void (*failure_exit)(void) ,
3518                         void (*log_bytes)(HChar * , Int nbytes ) ,   3518                         void (*log_bytes)(HChar * , Int nbytes ) ,
3519                         Int debuglevel , Bool valgrind_support ,   3519                         Int debuglevel , Bool valgrind_support ,
3520                         VexControl *vcon ) ;   3520                         VexControl *vcon ) ;
3521 extern VexTranslateResult LibVEX_Translate(VexTranslateArgs * ) ;   3521 extern VexTranslateResult LibVEX_Translate(VexTranslateArgs * ) ;
3522 extern void LibVEX_ShowStats(void) ;   3522 extern void LibVEX_ShowStats(void) ;
3523 void (*vgPlain_tl_pre_clo_init)(void) ;   3523 void (*vgPlain_tl_pre_clo_init)(void) ;
3524 extern void vgPlain_basic_tool_funcs(void (*post_clo_init)(void) ,   3524 extern void vgPlain_basic_tool_funcs(void (*post_clo_init)(void) ,
3525                                      IRSB *(*instrument)(VgCallbackClosure *closure ,   3525                                      IRSB *(*instrument)(VgCallbackClosure *closure ,
3526                                                          IRSB *sb_in ,   3526                                                          IRSB *sb_in ,
3527                                                          VexGuestLayout *layout ,   3527                                                          VexGuestLayout *layout ,
3528                                                          VexGuestExtents *vge ,   3528                                                          VexGuestExtents *vge ,
3529                                                          IRType gWordTy ,   3529                                                          IRType gWordTy ,
3530                                                          IRType hWordTy ) ,   3530                                                          IRType hWordTy ) ,
3531                                      void (*fini)(Int  ) ) ;   3531                                      void (*fini)(Int  ) ) ;
3532 extern void vgPlain_details_name(Char *name ) ;   3532 extern void vgPlain_details_name(Char *name ) ;
3533 extern void vgPlain_details_version(Char *version ) ;   3533 extern void vgPlain_details_version(Char *version ) ;
3534 extern void vgPlain_details_description(Char *description ) ;   3534 extern void vgPlain_details_description(Char *description ) ;
3535 extern void vgPlain_details_copyright_author(Char *copyright_author ) ;   3535 extern void vgPlain_details_copyright_author(Char *copyright_author ) ;
3536 extern void vgPlain_details_avg_translation_sizeB(UInt size ) ;   3536 extern void vgPlain_details_avg_translation_sizeB(UInt size ) ;
3537 extern void vgPlain_details_bug_reports_to(Char *bug_reports_to ) ;   3537 extern void vgPlain_details_bug_reports_to(Char *bug_reports_to ) ;
3538 extern void vgPlain_needs_libc_freeres(void) ;   3538 extern void vgPlain_needs_libc_freeres(void) ;
3539 extern void vgPlain_needs_core_errors(void) ;   3539 extern void vgPlain_needs_core_errors(void) ;
3540 extern void vgPlain_needs_tool_errors(Bool (*eq_Error)(VgRes res , Error *e1 ,   3540 extern void vgPlain_needs_tool_errors(Bool (*eq_Error)(VgRes res , Error *e1 ,
3541                                                        Error *e2 ) ,   3541                                                        Error *e2 ) ,
3542                                       void (*before_pp_Error)(Error *err ) ,   3542                                       void (*before_pp_Error)(Error *err ) ,
3543                                       void (*pp_Error)(Error *err ) ,   3543                                       void (*pp_Error)(Error *err ) ,
3544                                       Bool show_ThreadIDs_for_errors ,   3544                                       Bool show_ThreadIDs_for_errors ,
3545                                       UInt (*update_extra)(Error *err ) ,   3545                                       UInt (*update_extra)(Error *err ) ,
3546                                       Bool (*recognised_suppression)(Char *name ,   3546                                       Bool (*recognised_suppression)(Char *name ,
3547                                                                      Supp *su ) ,   3547                                                                      Supp *su ) ,
3548                                       Bool (*read_extra_suppression_info)(Int fd ,   3548                                       Bool (*read_extra_suppression_info)(Int fd ,
3549                                                                           Char **bufpp ,   3549                                                                           Char **bufpp ,
3550                                                                           SizeT *nBufp ,   3550                                                                           SizeT *nBufp ,
3551                                                                           Supp *su ) ,   3551                                                                           Supp *su ) ,
3552                                       Bool (*error_matches_suppression)(Error *err ,   3552                                       Bool (*error_matches_suppression)(Error *err ,
3553                                                                         Supp *su ) ,   3553                                                                         Supp *su ) ,
3554                                       Char *(*get_error_name)(Error *err ) ,   3554                                       Char *(*get_error_name)(Error *err ) ,
3555                                       Bool (*print_extra_suppression_info)(Error *err ,   3555                                       Bool (*print_extra_suppression_info)(Error *err ,
3556                                                                            Char *buf ,   3556                                                                            Char *buf ,
3557                                                                            Int nBuf ) ) ;   3557                                                                            Int nBuf ) ) ;
3558 extern void vgPlain_needs_superblock_discards(void (*discard_superblock_info)(Addr64 orig_addr ,   3558 extern void vgPlain_needs_superblock_discards(void (*discard_superblock_info)(Addr64 orig_addr ,
3559                                                                               VexGuestExtents extents ) ) ;   3559                                                                               VexGuestExtents extents ) ) ;
3560 extern void vgPlain_needs_command_line_options(Bool (*process_cmd_line_option)(Char *argv ) ,   3560 extern void vgPlain_needs_command_line_options(Bool (*process_cmd_line_option)(Char *argv ) ,
3561                                                void (*print_usage)(void) ,   3561                                                void (*print_usage)(void) ,
3562                                                void (*print_debug_usage)(void) ) ;   3562                                                void (*print_debug_usage)(void) ) ;
3563 extern void vgPlain_needs_client_requests(Bool (*handle_client_request)(ThreadId tid ,   3563 extern void vgPlain_needs_client_requests(Bool (*handle_client_request)(ThreadId tid ,
3564                                                                         UWord *arg_block ,   3564                                                                         UWord *arg_block ,
3565                                                                         UWord *ret ) ) ;   3565                                                                         UWord *ret ) ) ;
3566 extern void vgPlain_needs_syscall_wrapper(void (*pre_syscall)(ThreadId tid ,   3566 extern void vgPlain_needs_syscall_wrapper(void (*pre_syscall)(ThreadId tid ,
3567                                                               UInt syscallno ,   3567                                                               UInt syscallno ,
3568                                                               UWord *args ,   3568                                                               UWord *args ,
3569                                                               UInt nArgs ) ,   3569                                                               UInt nArgs ) ,
3570                                           void (*post_syscall)(ThreadId tid ,   3570                                           void (*post_syscall)(ThreadId tid ,
3571                                                                UInt syscallno ,   3571                                                                UInt syscallno ,
3572                                                                UWord *args ,   3572                                                                UWord *args ,
3573                                                                UInt nArgs ,   3573                                                                UInt nArgs ,
3574                                                                SysRes res ) ) ;   3574                                                                SysRes res ) ) ;
3575 extern void vgPlain_needs_sanity_checks(Bool (*cheap_sanity_check)(void) ,   3575 extern void vgPlain_needs_sanity_checks(Bool (*cheap_sanity_check)(void) ,
3576                                         Bool (*expensive_sanity_check)(void) ) ;   3576                                         Bool (*expensive_sanity_check)(void) ) ;
3577 extern void vgPlain_needs_var_info(void) ;   3577 extern void vgPlain_needs_var_info(void) ;
3578 extern void vgPlain_needs_malloc_replacement(void *(*pmalloc)(ThreadId tid ,   3578 extern void vgPlain_needs_malloc_replacement(void *(*pmalloc)(ThreadId tid ,
3579                                                               SizeT n ) ,   3579                                                               SizeT n ) ,
3580                                              void *(*p__builtin_new)(ThreadId tid ,   3580                                              void *(*p__builtin_new)(ThreadId tid ,
3581                                                                      SizeT n ) ,   3581                                                                      SizeT n ) ,
3582                                              void *(*p__builtin_vec_new)(ThreadId tid ,   3582                                              void *(*p__builtin_vec_new)(ThreadId tid ,
3583                                                                          SizeT n ) ,   3583                                                                          SizeT n ) ,
3584                                              void *(*pmemalign)(ThreadId tid ,   3584                                              void *(*pmemalign)(ThreadId tid ,
3585                                                                 SizeT align ,   3585                                                                 SizeT align ,
3586                                                                 SizeT n ) ,   3586                                                                 SizeT n ) ,
3587                                              void *(*pcalloc)(ThreadId tid ,   3587                                              void *(*pcalloc)(ThreadId tid ,
3588                                                               SizeT nmemb ,   3588                                                               SizeT nmemb ,
3589                                                               SizeT size1 ) ,   3589                                                               SizeT size1 ) ,
3590                                              void (*pfree)(ThreadId tid ,   3590                                              void (*pfree)(ThreadId tid ,
3591                                                            void *p ) ,   3591                                                            void *p ) ,
3592                                              void (*p__builtin_delete)(ThreadId tid ,   3592                                              void (*p__builtin_delete)(ThreadId tid ,
3593                                                                        void *p ) ,   3593                                                                        void *p ) ,
3594                                              void (*p__builtin_vec_delete)(ThreadId tid ,   3594                                              void (*p__builtin_vec_delete)(ThreadId tid ,
3595                                                                            void *p ) ,   3595                                                                            void *p ) ,
3596                                              void *(*prealloc)(ThreadId tid ,   3596                                              void *(*prealloc)(ThreadId tid ,
3597                                                                void *p ,   3597                                                                void *p ,
3598                                                                SizeT new_size ) ,   3598                                                                SizeT new_size ) ,
3599                                              SizeT (*pmalloc_usable_size)(ThreadId tid ,   3599                                              SizeT (*pmalloc_usable_size)(ThreadId tid ,
3600                                                                           void *p ) ,   3600                                                                           void *p ) ,
3601                                              SizeT client_malloc_redzone_szB ) ;   3601                                              SizeT client_malloc_redzone_szB ) ;
3602 extern void vgPlain_needs_xml_output(void) ;   3602 extern void vgPlain_needs_xml_output(void) ;
3603 extern void vgPlain_needs_final_IR_tidy_pass(IRSB *(*final_tidy)(IRSB * ) ) ;   3603 extern void vgPlain_needs_final_IR_tidy_pass(IRSB *(*final_tidy)(IRSB * ) ) ;
3604 extern void vgPlain_track_new_mem_startup(void (*f)(Addr a , SizeT len ,   3604 extern void vgPlain_track_new_mem_startup(void (*f)(Addr a , SizeT len ,
3605                                                     Bool rr , Bool ww ,   3605                                                     Bool rr , Bool ww ,
3606                                                     Bool xx , ULong di_handle ) ) ;   3606                                                     Bool xx , ULong di_handle ) ) ;
3607 extern void vgPlain_track_new_mem_stack_signal(void (*f)(Addr a , SizeT len ,   3607 extern void vgPlain_track_new_mem_stack_signal(void (*f)(Addr a , SizeT len ,
3608                                                          ThreadId tid ) ) ;   3608                                                          ThreadId tid ) ) ;
3609 extern void vgPlain_track_new_mem_brk(void (*f)(Addr a , SizeT len ,   3609 extern void vgPlain_track_new_mem_brk(void (*f)(Addr a , SizeT len ,
3610                                                 ThreadId tid ) ) ;   3610                                                 ThreadId tid ) ) ;
3611 extern void vgPlain_track_new_mem_mmap(void (*f)(Addr a , SizeT len , Bool rr ,   3611 extern void vgPlain_track_new_mem_mmap(void (*f)(Addr a , SizeT len , Bool rr ,
3612                                                  Bool ww , Bool xx ,   3612                                                  Bool ww , Bool xx ,
3613                                                  ULong di_handle ) ) ;   3613                                                  ULong di_handle ) ) ;
3614 extern void vgPlain_track_copy_mem_remap(void (*f)(Addr from , Addr to ,   3614 extern void vgPlain_track_copy_mem_remap(void (*f)(Addr from , Addr to ,
3615                                                    SizeT len ) ) ;   3615                                                    SizeT len ) ) ;
3616 extern void vgPlain_track_change_mem_mprotect(void (*f)(Addr a , SizeT len ,   3616 extern void vgPlain_track_change_mem_mprotect(void (*f)(Addr a , SizeT len ,
3617                                                         Bool rr , Bool ww ,   3617                                                         Bool rr , Bool ww ,
3618                                                         Bool xx ) ) ;   3618                                                         Bool xx ) ) ;
3619 extern void vgPlain_track_die_mem_stack_signal(void (*f)(Addr a , SizeT len ) ) ;   3619 extern void vgPlain_track_die_mem_stack_signal(void (*f)(Addr a , SizeT len ) ) ;
3620 extern void vgPlain_track_die_mem_brk(void (*f)(Addr a , SizeT len ) ) ;   3620 extern void vgPlain_track_die_mem_brk(void (*f)(Addr a , SizeT len ) ) ;
3621 extern void vgPlain_track_die_mem_munmap(void (*f)(Addr a , SizeT len ) ) ;   3621 extern void vgPlain_track_die_mem_munmap(void (*f)(Addr a , SizeT len ) ) ;
3622 extern void vgPlain_track_new_mem_stack_4_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3622 extern void vgPlain_track_new_mem_stack_4_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3623                                                                                              UInt ecu ) ) ;   3623                                                                                              UInt ecu ) ) ;
3624 extern void vgPlain_track_new_mem_stack_8_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3624 extern void vgPlain_track_new_mem_stack_8_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3625                                                                                              UInt ecu ) ) ;   3625                                                                                              UInt ecu ) ) ;
3626 extern void vgPlain_track_new_mem_stack_12_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3626 extern void vgPlain_track_new_mem_stack_12_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3627                                                                                               UInt ecu ) ) ;   3627                                                                                               UInt ecu ) ) ;
3628 extern void vgPlain_track_new_mem_stack_16_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3628 extern void vgPlain_track_new_mem_stack_16_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3629                                                                                               UInt ecu ) ) ;   3629                                                                                               UInt ecu ) ) ;
3630 extern void vgPlain_track_new_mem_stack_32_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3630 extern void vgPlain_track_new_mem_stack_32_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3631                                                                                               UInt ecu ) ) ;   3631                                                                                               UInt ecu ) ) ;
3632 extern void vgPlain_track_new_mem_stack_112_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3632 extern void vgPlain_track_new_mem_stack_112_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3633                                                                                                UInt ecu ) ) ;   3633                                                                                                UInt ecu ) ) ;
3634 extern void vgPlain_track_new_mem_stack_128_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3634 extern void vgPlain_track_new_mem_stack_128_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3635                                                                                                UInt ecu ) ) ;   3635                                                                                                UInt ecu ) ) ;
3636 extern void vgPlain_track_new_mem_stack_144_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3636 extern void vgPlain_track_new_mem_stack_144_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3637                                                                                                UInt ecu ) ) ;   3637                                                                                                UInt ecu ) ) ;
3638 extern void vgPlain_track_new_mem_stack_160_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3638 extern void vgPlain_track_new_mem_stack_160_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3639                                                                                                UInt ecu ) ) ;   3639                                                                                                UInt ecu ) ) ;
3640 extern void vgPlain_track_new_mem_stack_w_ECU(void (*f)(Addr a , SizeT len ,   3640 extern void vgPlain_track_new_mem_stack_w_ECU(void (*f)(Addr a , SizeT len ,
3641                                                         UInt ecu ) ) ;   3641                                                         UInt ecu ) ) ;
3642 extern void vgPlain_track_new_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3642 extern void vgPlain_track_new_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3643 extern void vgPlain_track_new_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3643 extern void vgPlain_track_new_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3644 extern void vgPlain_track_new_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3644 extern void vgPlain_track_new_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3645 extern void vgPlain_track_new_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3645 extern void vgPlain_track_new_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3646 extern void vgPlain_track_new_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3646 extern void vgPlain_track_new_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3647 extern void vgPlain_track_new_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3647 extern void vgPlain_track_new_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3648 extern void vgPlain_track_new_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3648 extern void vgPlain_track_new_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3649 extern void vgPlain_track_new_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3649 extern void vgPlain_track_new_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3650 extern void vgPlain_track_new_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3650 extern void vgPlain_track_new_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3651 extern void vgPlain_track_new_mem_stack(void (*f)(Addr a , SizeT len ) ) ;   3651 extern void vgPlain_track_new_mem_stack(void (*f)(Addr a , SizeT len ) ) ;
3652 extern void vgPlain_track_die_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3652 extern void vgPlain_track_die_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3653 extern void vgPlain_track_die_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3653 extern void vgPlain_track_die_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3654 extern void vgPlain_track_die_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3654 extern void vgPlain_track_die_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3655 extern void vgPlain_track_die_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3655 extern void vgPlain_track_die_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3656 extern void vgPlain_track_die_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3656 extern void vgPlain_track_die_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3657 extern void vgPlain_track_die_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3657 extern void vgPlain_track_die_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3658 extern void vgPlain_track_die_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3658 extern void vgPlain_track_die_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3659 extern void vgPlain_track_die_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3659 extern void vgPlain_track_die_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3660 extern void vgPlain_track_die_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3660 extern void vgPlain_track_die_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3661 extern void vgPlain_track_die_mem_stack(void (*f)(Addr a , SizeT len ) ) ;   3661 extern void vgPlain_track_die_mem_stack(void (*f)(Addr a , SizeT len ) ) ;
3662 extern void vgPlain_track_ban_mem_stack(void (*f)(Addr a , SizeT len ) ) ;   3662 extern void vgPlain_track_ban_mem_stack(void (*f)(Addr a , SizeT len ) ) ;
3663 extern void vgPlain_track_pre_mem_read(void (*f)(CorePart part , ThreadId tid ,   3663 extern void vgPlain_track_pre_mem_read(void (*f)(CorePart part , ThreadId tid ,
3664                                                  Char *s , Addr a , SizeT size ) ) ;   3664                                                  Char *s , Addr a , SizeT size ) ) ;
3665 extern void vgPlain_track_pre_mem_read_asciiz(void (*f)(CorePart part ,   3665 extern void vgPlain_track_pre_mem_read_asciiz(void (*f)(CorePart part ,
3666                                                         ThreadId tid , Char *s ,   3666                                                         ThreadId tid , Char *s ,
3667                                                         Addr a ) ) ;   3667                                                         Addr a ) ) ;
3668 extern void vgPlain_track_pre_mem_write(void (*f)(CorePart part , ThreadId tid ,   3668 extern void vgPlain_track_pre_mem_write(void (*f)(CorePart part , ThreadId tid ,
3669                                                   Char *s , Addr a , SizeT size ) ) ;   3669                                                   Char *s , Addr a , SizeT size ) ) ;
3670 extern void vgPlain_track_post_mem_write(void (*f)(CorePart part ,   3670 extern void vgPlain_track_post_mem_write(void (*f)(CorePart part ,
3671                                                    ThreadId tid , Addr a ,   3671                                                    ThreadId tid , Addr a ,
3672                                                    SizeT size ) ) ;   3672                                                    SizeT size ) ) ;
3673 extern void vgPlain_track_pre_reg_read(void (*f)(CorePart part , ThreadId tid ,   3673 extern void vgPlain_track_pre_reg_read(void (*f)(CorePart part , ThreadId tid ,
3674                                                  Char *s ,   3674                                                  Char *s ,
3675                                                  PtrdiffT guest_state_offset ,   3675                                                  PtrdiffT guest_state_offset ,
3676                                                  SizeT size ) ) ;   3676                                                  SizeT size ) ) ;
3677 extern void vgPlain_track_post_reg_write(void (*f)(CorePart part ,   3677 extern void vgPlain_track_post_reg_write(void (*f)(CorePart part ,
3678                                                    ThreadId tid ,   3678                                                    ThreadId tid ,
3679                                                    PtrdiffT guest_state_offset ,   3679                                                    PtrdiffT guest_state_offset ,
3680                                                    SizeT size ) ) ;   3680                                                    SizeT size ) ) ;
3681 extern void vgPlain_track_post_reg_write_clientcall_return(void (*f)(ThreadId tid ,   3681 extern void vgPlain_track_post_reg_write_clientcall_return(void (*f)(ThreadId tid ,
3682                                                                      PtrdiffT guest_state_offset ,   3682                                                                      PtrdiffT guest_state_offset ,
3683                                                                      SizeT size ,   3683                                                                      SizeT size ,
3684                                                                      Addr f ) ) ;   3684                                                                      Addr f ) ) ;
3685 extern void vgPlain_track_start_client_code(void (*f)(ThreadId tid ,   3685 extern void vgPlain_track_start_client_code(void (*f)(ThreadId tid ,
3686                                                       ULong blocks_dispatched ) ) ;   3686                                                       ULong blocks_dispatched ) ) ;
3687 extern void vgPlain_track_stop_client_code(void (*f)(ThreadId tid ,   3687 extern void vgPlain_track_stop_client_code(void (*f)(ThreadId tid ,
3688                                                      ULong blocks_dispatched ) ) ;   3688                                                      ULong blocks_dispatched ) ) ;
3689 extern void vgPlain_track_pre_thread_ll_create(void (*f)(ThreadId tid ,   3689 extern void vgPlain_track_pre_thread_ll_create(void (*f)(ThreadId tid ,
3690                                                          ThreadId child ) ) ;   3690                                                          ThreadId child ) ) ;
3691 extern void vgPlain_track_pre_thread_first_insn(void (*f)(ThreadId tid ) ) ;   3691 extern void vgPlain_track_pre_thread_first_insn(void (*f)(ThreadId tid ) ) ;
3692 extern void vgPlain_track_pre_thread_ll_exit(void (*f)(ThreadId tid ) ) ;   3692 extern void vgPlain_track_pre_thread_ll_exit(void (*f)(ThreadId tid ) ) ;
3693 extern void vgPlain_track_pre_deliver_signal(void (*f)(ThreadId tid ,   3693 extern void vgPlain_track_pre_deliver_signal(void (*f)(ThreadId tid ,
3694                                                        Int sigNo ,   3694                                                        Int sigNo ,
3695                                                        Bool alt_stack ) ) ;   3695                                                        Bool alt_stack ) ) ;
3696 extern void vgPlain_track_post_deliver_signal(void (*f)(ThreadId tid ,   3696 extern void vgPlain_track_post_deliver_signal(void (*f)(ThreadId tid ,
3697                                                         Int sigNo ) ) ;   3697                                                         Int sigNo ) ) ;
3698 extern VgHashTable vgPlain_HT_construct(HChar *name ) ;   3698 extern VgHashTable vgPlain_HT_construct(HChar *name ) ;
3699 extern Int vgPlain_HT_count_nodes(VgHashTable table ) ;   3699 extern Int vgPlain_HT_count_nodes(VgHashTable table ) ;
3700 extern void vgPlain_HT_add_node(VgHashTable t , void *node ) ;   3700 extern void vgPlain_HT_add_node(VgHashTable t , void *node ) ;
3701 extern void *vgPlain_HT_lookup(VgHashTable table , UWord key ) ;   3701 extern void *vgPlain_HT_lookup(VgHashTable table , UWord key ) ;
3702 extern void *vgPlain_HT_remove(VgHashTable table , UWord key ) ;   3702 extern void *vgPlain_HT_remove(VgHashTable table , UWord key ) ;
3703 extern VgHashNode **vgPlain_HT_to_array(VgHashTable t , UInt *n_elems ) ;   3703 extern VgHashNode **vgPlain_HT_to_array(VgHashTable t , UInt *n_elems ) ;
3704 extern void vgPlain_HT_ResetIter(VgHashTable table ) ;   3704 extern void vgPlain_HT_ResetIter(VgHashTable table ) ;
3705 extern void *vgPlain_HT_Next(VgHashTable table ) ;   3705 extern void *vgPlain_HT_Next(VgHashTable table ) ;
3706 extern void vgPlain_HT_destruct(VgHashTable t ) ;   3706 extern void vgPlain_HT_destruct(VgHashTable t ) ;
3707 extern void *vgPlain_cli_malloc(SizeT align , SizeT nbytes ) ;   3707 extern void *vgPlain_cli_malloc(SizeT align , SizeT nbytes ) ;
3708 extern void vgPlain_cli_free(void *p ) ;   3708 extern void vgPlain_cli_free(void *p ) ;
3709 extern Long vgPlain_free_queue_volume ;   3709 extern Long vgPlain_free_queue_volume ;
3710 extern Long vgPlain_free_queue_length ;   3710 extern Long vgPlain_free_queue_length ;
3711 extern Bool vgPlain_addr_is_in_block(Addr a , Addr start , SizeT size ,   3711 extern Bool vgPlain_addr_is_in_block(Addr a , Addr start , SizeT size ,
3712                                      SizeT rz_szB ) ;   3712                                      SizeT rz_szB ) ;
3713 extern Bool vgPlain_clo_trace_malloc ;   3713 extern Bool vgPlain_clo_trace_malloc ;
3714 extern UInt vgPlain_clo_alignment ;   3714 extern UInt vgPlain_clo_alignment ;
3715 extern Bool vgPlain_replacement_malloc_process_cmd_line_option(Char *arg ) ;   3715 extern Bool vgPlain_replacement_malloc_process_cmd_line_option(Char *arg ) ;
3716 extern Addr vgPlain_get_IP(ThreadId tid ) ;   3716 extern Addr vgPlain_get_IP(ThreadId tid ) ;
3717 extern Addr vgPlain_get_SP(ThreadId tid ) ;   3717 extern Addr vgPlain_get_SP(ThreadId tid ) ;
3718 extern void vgPlain_get_shadow_regs_area(ThreadId tid , UChar *dst ,   3718 extern void vgPlain_get_shadow_regs_area(ThreadId tid , UChar *dst ,
3719                                          Int shadowNo , PtrdiffT offset ,   3719                                          Int shadowNo , PtrdiffT offset ,
3720                                          SizeT size ) ;   3720                                          SizeT size ) ;
3721 extern void vgPlain_set_shadow_regs_area(ThreadId tid , Int shadowNo ,   3721 extern void vgPlain_set_shadow_regs_area(ThreadId tid , Int shadowNo ,
3722                                          PtrdiffT offset , SizeT size ,   3722                                          PtrdiffT offset , SizeT size ,
3723                                          UChar const   *src ) ;   3723                                          UChar const   *src ) ;
3724 extern void vgPlain_set_syscall_return_shadows(ThreadId tid , UWord s1res ,   3724 extern void vgPlain_set_syscall_return_shadows(ThreadId tid , UWord s1res ,
3725                                                UWord s2res , UWord s1err ,   3725                                                UWord s2res , UWord s1err ,
3726                                                UWord s2err ) ;   3726                                                UWord s2err ) ;
3727 extern void vgPlain_apply_to_GP_regs(void (*f)(UWord val ) ) ;   3727 extern void vgPlain_apply_to_GP_regs(void (*f)(UWord val ) ) ;
3728 extern void vgPlain_thread_stack_reset_iter(ThreadId *tid ) ;   3728 extern void vgPlain_thread_stack_reset_iter(ThreadId *tid ) ;
3729 extern Bool vgPlain_thread_stack_next(ThreadId *tid , Addr *stack_min ,   3729 extern Bool vgPlain_thread_stack_next(ThreadId *tid , Addr *stack_min ,
3730                                       Addr *stack_max ) ;   3730                                       Addr *stack_max ) ;
3731 extern Addr vgPlain_thread_get_stack_max(ThreadId tid ) ;   3731 extern Addr vgPlain_thread_get_stack_max(ThreadId tid ) ;
3732 extern SizeT vgPlain_thread_get_stack_size(ThreadId tid ) ;   3732 extern SizeT vgPlain_thread_get_stack_size(ThreadId tid ) ;
3733 extern Addr vgPlain_thread_get_altstack_min(ThreadId tid ) ;   3733 extern Addr vgPlain_thread_get_altstack_min(ThreadId tid ) ;
3734 extern SizeT vgPlain_thread_get_altstack_size(ThreadId tid ) ;   3734 extern SizeT vgPlain_thread_get_altstack_size(ThreadId tid ) ;
3735 extern void *vgPlain_fnptr_to_fnentry(void * ) ;   3735 extern void *vgPlain_fnptr_to_fnentry(void * ) ;
3736 extern Int vgPlain_clo_verbosity ;   3736 extern Int vgPlain_clo_verbosity ;
3737 extern Bool vgPlain_clo_stats ;   3737 extern Bool vgPlain_clo_stats ;
3738 extern Bool vgPlain_clo_xml ;   3738 extern Bool vgPlain_clo_xml ;
3739 extern HChar *vgPlain_clo_xml_user_comment ;   3739 extern HChar *vgPlain_clo_xml_user_comment ;
3740 extern VexControl vgPlain_clo_vex_control ;   3740 extern VexControl vgPlain_clo_vex_control ;
3741 extern Int vgPlain_clo_backtrace_size ;   3741 extern Int vgPlain_clo_backtrace_size ;
3742 extern Bool vgPlain_clo_show_below_main ;   3742 extern Bool vgPlain_clo_show_below_main ;
3743 extern Char *vgPlain_expand_file_name(Char *option_name , Char *format ) ;   3743 extern Char *vgPlain_expand_file_name(Char *option_name , Char *format ) ;
3744 extern XArray *vgPlain_newXA(void *(*alloc_fn)(HChar * , SizeT  ) , HChar *cc ,   3744 extern XArray *vgPlain_newXA(void *(*alloc_fn)(HChar * , SizeT  ) , HChar *cc ,
3745                              void (*free_fn)(void * ) , Word elemSzB ) ;   3745                              void (*free_fn)(void * ) , Word elemSzB ) ;
3746 extern void vgPlain_deleteXA(XArray * ) ;   3746 extern void vgPlain_deleteXA(XArray * ) ;
3747 extern void vgPlain_setCmpFnXA(XArray * , Int (*compar)(void * , void * ) ) ;   3747 extern void vgPlain_setCmpFnXA(XArray * , Int (*compar)(void * , void * ) ) ;
3748 extern Word vgPlain_addToXA(XArray * , void *elem ) ;   3748 extern Word vgPlain_addToXA(XArray * , void *elem ) ;
3749 extern Word vgPlain_addBytesToXA(XArray *xao , void *bytesV , Word nbytes ) ;   3749 extern Word vgPlain_addBytesToXA(XArray *xao , void *bytesV , Word nbytes ) ;
3750 extern void vgPlain_sortXA(XArray * ) ;   3750 extern void vgPlain_sortXA(XArray * ) ;
3751 extern Bool vgPlain_lookupXA(XArray * , void *key , Word *first , Word *last ) ;   3751 extern Bool vgPlain_lookupXA(XArray * , void *key , Word *first , Word *last ) ;
3752 extern Bool vgPlain_lookupXA_UNSAFE(XArray *xao , void *key , Word *first ,   3752 extern Bool vgPlain_lookupXA_UNSAFE(XArray *xao , void *key , Word *first ,
3753                                     Word *last , Int (*cmpFn)(void * , void * ) ) ;   3753                                     Word *last , Int (*cmpFn)(void * , void * ) ) ;
3754 extern Word vgPlain_sizeXA(XArray * ) ;   3754 extern Word vgPlain_sizeXA(XArray * ) ;
3755 extern void *vgPlain_indexXA(XArray * , Word  ) ;   3755 extern void *vgPlain_indexXA(XArray * , Word  ) ;
3756 extern void vgPlain_dropTailXA(XArray * , Word  ) ;   3756 extern void vgPlain_dropTailXA(XArray * , Word  ) ;
3757 extern void vgPlain_dropHeadXA(XArray * , Word  ) ;   3757 extern void vgPlain_dropHeadXA(XArray * , Word  ) ;
3758 extern XArray *vgPlain_cloneXA(HChar *cc , XArray *xa ) ;   3758 extern XArray *vgPlain_cloneXA(HChar *cc , XArray *xa ) ;
3759 extern void vgPlain_getContentsXA_UNSAFE(XArray *sr , void **ctsP , Word *usedP ) ;   3759 extern void vgPlain_getContentsXA_UNSAFE(XArray *sr , void **ctsP , Word *usedP ) ;
3760 extern void ( /* format attribute */  vgPlain_xaprintf)(XArray *dst ,   3760 extern void ( /* format attribute */  vgPlain_xaprintf)(XArray *dst ,
3761                                                         HChar const   *format   3761                                                         HChar const   *format
3762                                                         , ...) ;   3762                                                         , ...) ;
3763 extern void vgPlain_xaprintf_no_f_c(XArray *dst , HChar const   *format  , ...) ;   3763 extern void vgPlain_xaprintf_no_f_c(XArray *dst , HChar const   *format  , ...) ;
3764 extern UInt vgPlain_get_StackTrace(ThreadId tid , StackTrace ips , UInt n_ips ,   3764 extern UInt vgPlain_get_StackTrace(ThreadId tid , StackTrace ips , UInt n_ips ,
3765                                    StackTrace sps , StackTrace fps ,   3765                                    StackTrace sps , StackTrace fps ,
3766                                    Word first_ip_delta ) ;   3766                                    Word first_ip_delta ) ;
3767 extern void vgPlain_apply_StackTrace(void (*action)(UInt n , Addr ip ,   3767 extern void vgPlain_apply_StackTrace(void (*action)(UInt n , Addr ip ,
3768                                                     void *opaque ) ,   3768                                                     void *opaque ) ,
3769                                      void *opaque , StackTrace ips , UInt n_ips ) ;   3769                                      void *opaque , StackTrace ips , UInt n_ips ) ;
3770 extern void vgPlain_pp_StackTrace(StackTrace ips , UInt n_ips ) ;   3770 extern void vgPlain_pp_StackTrace(StackTrace ips , UInt n_ips ) ;
3771 extern void vgPlain_get_and_pp_StackTrace(ThreadId tid , UInt n_ips ) ;   3771 extern void vgPlain_get_and_pp_StackTrace(ThreadId tid , UInt n_ips ) ;
3772 extern WordFM *vgPlain_newFM(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,   3772 extern WordFM *vgPlain_newFM(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,
3773                              HChar *cc , void (*dealloc)(void * ) ,   3773                              HChar *cc , void (*dealloc)(void * ) ,
3774                              Word (*kCmp)(UWord  , UWord  ) ) ;   3774                              Word (*kCmp)(UWord  , UWord  ) ) ;
3775 extern void vgPlain_deleteFM(WordFM * , void (*kFin)(UWord  ) ,   3775 extern void vgPlain_deleteFM(WordFM * , void (*kFin)(UWord  ) ,
3776                              void (*vFin)(UWord  ) ) ;   3776                              void (*vFin)(UWord  ) ) ;
3777 extern Bool vgPlain_addToFM(WordFM *fm , UWord k , UWord v ) ;   3777 extern Bool vgPlain_addToFM(WordFM *fm , UWord k , UWord v ) ;
3778 extern Bool vgPlain_delFromFM(WordFM *fm , UWord *oldK , UWord *oldV ,   3778 extern Bool vgPlain_delFromFM(WordFM *fm , UWord *oldK , UWord *oldV ,
3779                               UWord key ) ;   3779                               UWord key ) ;
3780 extern Bool vgPlain_lookupFM(WordFM *fm , UWord *keyP , UWord *valP , UWord key ) ;   3780 extern Bool vgPlain_lookupFM(WordFM *fm , UWord *keyP , UWord *valP , UWord key ) ;
3781 extern Bool vgPlain_findBoundsFM(WordFM *fm , UWord *kMinP , UWord *vMinP ,   3781 extern Bool vgPlain_findBoundsFM(WordFM *fm , UWord *kMinP , UWord *vMinP ,
3782                                  UWord *kMaxP , UWord *vMaxP , UWord minKey ,   3782                                  UWord *kMaxP , UWord *vMaxP , UWord minKey ,
3783                                  UWord minVal , UWord maxKey , UWord maxVal ,   3783                                  UWord minVal , UWord maxKey , UWord maxVal ,
3784                                  UWord key ) ;   3784                                  UWord key ) ;
3785 extern UWord vgPlain_sizeFM(WordFM *fm ) ;   3785 extern UWord vgPlain_sizeFM(WordFM *fm ) ;
3786 extern void vgPlain_initIterFM(WordFM *fm ) ;   3786 extern void vgPlain_initIterFM(WordFM *fm ) ;
3787 extern void vgPlain_initIterAtFM(WordFM *fm , UWord start_at ) ;   3787 extern void vgPlain_initIterAtFM(WordFM *fm , UWord start_at ) ;
3788 extern Bool vgPlain_nextIterFM(WordFM *fm , UWord *pKey , UWord *pVal ) ;   3788 extern Bool vgPlain_nextIterFM(WordFM *fm , UWord *pKey , UWord *pVal ) ;
3789 extern void vgPlain_doneIterFM(WordFM *fm ) ;   3789 extern void vgPlain_doneIterFM(WordFM *fm ) ;
3790 extern WordFM *vgPlain_dopyFM(WordFM *fm , UWord (*dopyK)(UWord  ) ,   3790 extern WordFM *vgPlain_dopyFM(WordFM *fm , UWord (*dopyK)(UWord  ) ,
3791                               UWord (*dopyV)(UWord  ) ) ;   3791                               UWord (*dopyV)(UWord  ) ) ;
3792 extern SizeT vgPlain_getNodeSizeFM(void) ;   3792 extern SizeT vgPlain_getNodeSizeFM(void) ;
3793 extern WordBag *vgPlain_newBag(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,   3793 extern WordBag *vgPlain_newBag(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,
3794                                HChar *cc , void (*dealloc)(void * ) ) ;   3794                                HChar *cc , void (*dealloc)(void * ) ) ;
3795 extern void vgPlain_deleteBag(WordBag * ) ;   3795 extern void vgPlain_deleteBag(WordBag * ) ;
3796 extern void vgPlain_addToBag(WordBag * , UWord  ) ;   3796 extern void vgPlain_addToBag(WordBag * , UWord  ) ;
3797 extern UWord vgPlain_elemBag(WordBag * , UWord  ) ;   3797 extern UWord vgPlain_elemBag(WordBag * , UWord  ) ;
3798 extern Bool vgPlain_delFromBag(WordBag * , UWord  ) ;   3798 extern Bool vgPlain_delFromBag(WordBag * , UWord  ) ;
3799 extern Bool vgPlain_isEmptyBag(WordBag * ) ;   3799 extern Bool vgPlain_isEmptyBag(WordBag * ) ;
3800 extern Bool vgPlain_isSingletonTotalBag(WordBag * ) ;   3800 extern Bool vgPlain_isSingletonTotalBag(WordBag * ) ;
3801 extern UWord vgPlain_anyElementOfBag(WordBag * ) ;   3801 extern UWord vgPlain_anyElementOfBag(WordBag * ) ;
3802 extern UWord vgPlain_sizeUniqueBag(WordBag * ) ;   3802 extern UWord vgPlain_sizeUniqueBag(WordBag * ) ;
3803 extern UWord vgPlain_sizeTotalBag(WordBag * ) ;   3803 extern UWord vgPlain_sizeTotalBag(WordBag * ) ;
3804 extern void vgPlain_initIterBag(WordBag * ) ;   3804 extern void vgPlain_initIterBag(WordBag * ) ;
3805 extern Bool vgPlain_nextIterBag(WordBag * , UWord *pVal , UWord *pCount ) ;   3805 extern Bool vgPlain_nextIterBag(WordBag * , UWord *pVal , UWord *pCount ) ;
3806 extern void vgPlain_doneIterBag(WordBag * ) ;   3806 extern void vgPlain_doneIterBag(WordBag * ) ;
3807 extern Bool vgPlain_get_filename(Addr a , Char *filename , Int n_filename ) ;   3807 extern Bool vgPlain_get_filename(Addr a , Char *filename , Int n_filename ) ;
3808 extern Bool vgPlain_get_fnname(Addr a , Char *fnname , Int n_fnname ) ;   3808 extern Bool vgPlain_get_fnname(Addr a , Char *fnname , Int n_fnname ) ;
3809 extern Bool vgPlain_get_linenum(Addr a , UInt *linenum ) ;   3809 extern Bool vgPlain_get_linenum(Addr a , UInt *linenum ) ;
3810 extern Bool vgPlain_get_fnname_w_offset(Addr a , Char *fnname , Int n_fnname ) ;   3810 extern Bool vgPlain_get_fnname_w_offset(Addr a , Char *fnname , Int n_fnname ) ;
3811 extern Bool vgPlain_get_filename_linenum(Addr a , Char *filename ,   3811 extern Bool vgPlain_get_filename_linenum(Addr a , Char *filename ,
3812                                          Int n_filename , Char *dirname ,   3812                                          Int n_filename , Char *dirname ,
3813                                          Int n_dirname ,   3813                                          Int n_dirname ,
3814                                          Bool *dirname_available ,   3814                                          Bool *dirname_available ,
3815                                          UInt *linenum ) ;   3815                                          UInt *linenum ) ;
3816 extern Bool vgPlain_get_fnname_if_entry(Addr a , Char *fnname , Int n_fnname ) ;   3816 extern Bool vgPlain_get_fnname_if_entry(Addr a , Char *fnname , Int n_fnname ) ;
3817 extern Vg_FnNameKind vgPlain_get_fnname_kind(Char *name ) ;   3817 extern Vg_FnNameKind vgPlain_get_fnname_kind(Char *name ) ;
3818 extern Vg_FnNameKind vgPlain_get_fnname_kind_from_IP(Addr ip ) ;   3818 extern Vg_FnNameKind vgPlain_get_fnname_kind_from_IP(Addr ip ) ;
3819 extern Bool vgPlain_get_datasym_and_offset(Addr data_addr , Char *dname ,   3819 extern Bool vgPlain_get_datasym_and_offset(Addr data_addr , Char *dname ,
3820                                            Int n_dname , PtrdiffT *offset ) ;   3820                                            Int n_dname , PtrdiffT *offset ) ;
3821 extern Bool vgPlain_get_data_description(void *dname1v , void *dname2v ,   3821 extern Bool vgPlain_get_data_description(void *dname1v , void *dname2v ,
3822                                          Addr data_addr ) ;   3822                                          Addr data_addr ) ;
3823 extern Bool vgPlain_get_objname(Addr a , Char *objname , Int n_objname ) ;   3823 extern Bool vgPlain_get_objname(Addr a , Char *objname , Int n_objname ) ;
3824 extern Char *vgPlain_describe_IP(Addr eip , Char *buf , Int n_buf ) ;   3824 extern Char *vgPlain_describe_IP(Addr eip , Char *buf , Int n_buf ) ;
3825 extern void *vgPlain_di_get_stack_blocks_at_ip(Addr ip , Bool arrays_only ) ;   3825 extern void *vgPlain_di_get_stack_blocks_at_ip(Addr ip , Bool arrays_only ) ;
3826 extern void *vgPlain_di_get_global_blocks_from_dihandle(ULong di_handle ,   3826 extern void *vgPlain_di_get_global_blocks_from_dihandle(ULong di_handle ,
3827                                                         Bool arrays_only ) ;   3827                                                         Bool arrays_only ) ;
3828 extern DebugInfo *vgPlain_find_DebugInfo(Addr a ) ;   3828 extern DebugInfo *vgPlain_find_DebugInfo(Addr a ) ;
3829 extern Addr vgPlain_DebugInfo_get_text_avma(DebugInfo const   *di ) ;   3829 extern Addr vgPlain_DebugInfo_get_text_avma(DebugInfo const   *di ) ;
3830 extern SizeT vgPlain_DebugInfo_get_text_size(DebugInfo const   *di ) ;   3830 extern SizeT vgPlain_DebugInfo_get_text_size(DebugInfo const   *di ) ;
3831 extern Addr vgPlain_DebugInfo_get_plt_avma(DebugInfo const   *di ) ;   3831 extern Addr vgPlain_DebugInfo_get_plt_avma(DebugInfo const   *di ) ;
3832 extern SizeT vgPlain_DebugInfo_get_plt_size(DebugInfo const   *di ) ;   3832 extern SizeT vgPlain_DebugInfo_get_plt_size(DebugInfo const   *di ) ;
3833 extern Addr vgPlain_DebugInfo_get_gotplt_avma(DebugInfo const   *di ) ;   3833 extern Addr vgPlain_DebugInfo_get_gotplt_avma(DebugInfo const   *di ) ;
3834 extern SizeT vgPlain_DebugInfo_get_gotplt_size(DebugInfo const   *di ) ;   3834 extern SizeT vgPlain_DebugInfo_get_gotplt_size(DebugInfo const   *di ) ;
3835 extern UChar const   *vgPlain_DebugInfo_get_soname(DebugInfo const   *di ) ;   3835 extern UChar const   *vgPlain_DebugInfo_get_soname(DebugInfo const   *di ) ;
3836 extern UChar const   *vgPlain_DebugInfo_get_filename(DebugInfo const   *di ) ;   3836 extern UChar const   *vgPlain_DebugInfo_get_filename(DebugInfo const   *di ) ;
3837 extern PtrdiffT vgPlain_DebugInfo_get_text_bias(DebugInfo const   *di ) ;   3837 extern PtrdiffT vgPlain_DebugInfo_get_text_bias(DebugInfo const   *di ) ;
3838 extern DebugInfo const   *vgPlain_next_DebugInfo(DebugInfo const   *di ) ;   3838 extern DebugInfo const   *vgPlain_next_DebugInfo(DebugInfo const   *di ) ;
3839 extern Int vgPlain_DebugInfo_syms_howmany(DebugInfo const   *di ) ;   3839 extern Int vgPlain_DebugInfo_syms_howmany(DebugInfo const   *di ) ;
3840 extern void vgPlain_DebugInfo_syms_getidx(DebugInfo const   *di , Int idx ,   3840 extern void vgPlain_DebugInfo_syms_getidx(DebugInfo const   *di , Int idx ,
3841                                           Addr *avma , Addr *tocptr ,   3841                                           Addr *avma , Addr *tocptr ,
3842                                           UInt *size , HChar **name ,   3842                                           UInt *size , HChar **name ,
3843                                           Bool *isText , Bool *isIFunc ) ;   3843                                           Bool *isText , Bool *isIFunc ) ;
3844 extern HChar const   *vgPlain_pp_SectKind(VgSectKind kind ) ;   3844 extern HChar const   *vgPlain_pp_SectKind(VgSectKind kind ) ;
3845 extern VgSectKind vgPlain_DebugInfo_sect_kind(UChar *name , SizeT n_name ,   3845 extern VgSectKind vgPlain_DebugInfo_sect_kind(UChar *name , SizeT n_name ,
3846                                               Addr a ) ;   3846                                               Addr a ) ;
3847 __inline static struct vki_cmsghdr *__vki_cmsg_nxthdr(void *__ctl ,   3847 __inline static struct vki_cmsghdr *__vki_cmsg_nxthdr(void *__ctl ,
3848                                                       __vki_kernel_size_t __size ,   3848                                                       __vki_kernel_size_t __size ,
3849                                                       struct vki_cmsghdr *__cmsg )   3849                                                       struct vki_cmsghdr *__cmsg )
3850 {   3850 {
3851   struct vki_cmsghdr *__ptr ;   3851   struct vki_cmsghdr *__ptr ;
3852     3852  
3853   {   3853   {
3854   __ptr = (struct vki_cmsghdr *)((unsigned char *)__cmsg + (((__cmsg->cmsg_len + sizeof(long )) - 1U) & ~ (sizeof(long ) - 1U)));   3854   __ptr = (struct vki_cmsghdr *)((unsigned char *)__cmsg + (((__cmsg->cmsg_len + sizeof(long )) - 1U) & ~ (sizeof(long ) - 1U)));
3855   if ((unsigned long )((char *)(__ptr + 1) - (char *)__ctl) > (unsigned long )__size) {   3855   if ((unsigned long )((char *)(__ptr + 1) - (char *)__ctl) > (unsigned long )__size) {
3856     return ((struct vki_cmsghdr *)0);   3856     return ((struct vki_cmsghdr *)0);
3857   } else {   3857   } else {
3858     3858  
3859   }   3859   }
3860   return (__ptr);   3860   return (__ptr);
3861 }   3861 }
3862 }   3862 }
3863 __inline static struct vki_cmsghdr *vki_cmsg_nxthdr(struct vki_msghdr *__msg ,   3863 __inline static struct vki_cmsghdr *vki_cmsg_nxthdr(struct vki_msghdr *__msg ,
3864                                                     struct vki_cmsghdr *__cmsg )   3864                                                     struct vki_cmsghdr *__cmsg )
3865 {   3865 {
3866   struct vki_cmsghdr *tmp ;   3866   struct vki_cmsghdr *tmp ;
3867     3867  
3868   {   3868   {
3869   tmp = __vki_cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);   3869   tmp = __vki_cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
3870   return (tmp);   3870   return (tmp);
3871 }   3871 }
3872 }   3872 }
3873 extern Char **vgPlain_client_envp ;   3873 extern Char **vgPlain_client_envp ;
3874 extern Char *vgPlain_getenv(Char *name ) ;   3874 extern Char *vgPlain_getenv(Char *name ) ;
3875 extern Char const   *vgPlain_libdir ;   3875 extern Char const   *vgPlain_libdir ;
3876 extern Char const   *vgPlain_LD_PRELOAD_var_name ;   3876 extern Char const   *vgPlain_LD_PRELOAD_var_name ;
3877 extern Int vgPlain_waitpid(Int pid , Int *status , Int options ) ;   3877 extern Int vgPlain_waitpid(Int pid , Int *status , Int options ) ;
3878 extern Int vgPlain_system(Char *cmd ) ;   3878 extern Int vgPlain_system(Char *cmd ) ;
3879 extern Int vgPlain_fork(void) ;   3879 extern Int vgPlain_fork(void) ;
3880 extern void vgPlain_execv(Char *filename , Char **argv ) ;   3880 extern void vgPlain_execv(Char *filename , Char **argv ) ;
3881 extern Int vgPlain_getrlimit(Int resource , struct vki_rlimit *rlim ) ;   3881 extern Int vgPlain_getrlimit(Int resource , struct vki_rlimit *rlim ) ;
3882 extern Int vgPlain_setrlimit(Int resource , struct vki_rlimit  const  *rlim ) ;   3882 extern Int vgPlain_setrlimit(Int resource , struct vki_rlimit  const  *rlim ) ;
3883 extern Int vgPlain_gettid(void) ;   3883 extern Int vgPlain_gettid(void) ;
3884 extern Int vgPlain_getpid(void) ;   3884 extern Int vgPlain_getpid(void) ;
3885 extern Int vgPlain_getppid(void) ;   3885 extern Int vgPlain_getppid(void) ;
3886 extern Int vgPlain_getpgrp(void) ;   3886 extern Int vgPlain_getpgrp(void) ;
3887 extern Int vgPlain_geteuid(void) ;   3887 extern Int vgPlain_geteuid(void) ;
3888 extern Int vgPlain_getegid(void) ;   3888 extern Int vgPlain_getegid(void) ;
3889 extern UInt vgPlain_read_millisecond_timer(void) ;   3889 extern UInt vgPlain_read_millisecond_timer(void) ;
3890 extern void vgPlain_atfork(void (*pre)(ThreadId  ) ,   3890 extern void vgPlain_atfork(void (*pre)(ThreadId  ) ,
3891                            void (*parent)(ThreadId  ) ,   3891                            void (*parent)(ThreadId  ) ,
3892                            void (*child)(ThreadId  ) ) ;   3892                            void (*child)(ThreadId  ) ) ;
3893 extern Int vgPlain_am_get_segment_starts(Addr *starts , Int nStarts ) ;   3893 extern Int vgPlain_am_get_segment_starts(Addr *starts , Int nStarts ) ;
3894 extern NSegment const   *vgPlain_am_find_nsegment(Addr a ) ;   3894 extern NSegment const   *vgPlain_am_find_nsegment(Addr a ) ;
3895 extern HChar *vgPlain_am_get_filename(NSegment const   * ) ;   3895 extern HChar *vgPlain_am_get_filename(NSegment const   * ) ;
3896 extern Bool vgPlain_am_is_valid_for_client(Addr start , SizeT len , UInt prot ) ;   3896 extern Bool vgPlain_am_is_valid_for_client(Addr start , SizeT len , UInt prot ) ;
3897 extern void *vgPlain_am_shadow_alloc(SizeT size ) ;   3897 extern void *vgPlain_am_shadow_alloc(SizeT size ) ;
3898 extern SysRes vgPlain_am_munmap_valgrind(Addr start , SizeT length ) ;   3898 extern SysRes vgPlain_am_munmap_valgrind(Addr start , SizeT length ) ;
3899 extern void *vgHelgrind_zalloc(HChar *cc , SizeT n ) ;   3899 extern void *vgHelgrind_zalloc(HChar *cc , SizeT n ) ;
3900 extern void vgHelgrind_free(void *p ) ;   3900 extern void vgHelgrind_free(void *p ) ;
3901 extern Char *vgHelgrind_strdup(HChar *cc , Char const   *s ) ;   3901 extern Char *vgHelgrind_strdup(HChar *cc , Char const   *s ) ;
3902 __inline static Bool vgHelgrind_is_sane_ThreadId(ThreadId coretid )   3902 __inline static Bool vgHelgrind_is_sane_ThreadId(ThreadId coretid )
3903 {   3903 {
3904   int tmp ;   3904   int tmp ;
3905     3905  
3906   {   3906   {
3907   if (coretid >= 0U) {   3907   if (coretid >= 0U) {
3908     if (coretid < 500U) {   3908     if (coretid < 500U) {
3909       tmp = 1;   3909       tmp = 1;
3910     } else {   3910     } else {
3911       tmp = 0;   3911       tmp = 0;
3912     }   3912     }
3913   } else {   3913   } else {
3914     tmp = 0;   3914     tmp = 0;
3915   }   3915   }
3916   return ((Bool )tmp);   3916   return ((Bool )tmp);
3917 }   3917 }
3918 }   3918 }
3919 extern Bool vgHelgrind_clo_track_lockorders ;   3919 extern Bool vgHelgrind_clo_track_lockorders ;
3920 extern Bool vgHelgrind_clo_cmp_race_err_addrs ;   3920 extern Bool vgHelgrind_clo_cmp_race_err_addrs ;
3921 extern UWord vgHelgrind_clo_history_level ;   3921 extern UWord vgHelgrind_clo_history_level ;
3922 extern UWord vgHelgrind_clo_conflict_cache_size ;   3922 extern UWord vgHelgrind_clo_conflict_cache_size ;
3923 extern Word vgHelgrind_clo_sanity_flags ;   3923 extern Word vgHelgrind_clo_sanity_flags ;
3924 extern WordSetU *vgHelgrind_newWordSetU(void *(*alloc_nofail)(HChar * , SizeT  ) ,   3924 extern WordSetU *vgHelgrind_newWordSetU(void *(*alloc_nofail)(HChar * , SizeT  ) ,
3925                                         HChar *cc , void (*dealloc)(void * ) ,   3925                                         HChar *cc , void (*dealloc)(void * ) ,
3926                                         Word cacheSize ) ;   3926                                         Word cacheSize ) ;
3927 extern void vgHelgrind_deleteWordSetU(WordSetU * ) ;   3927 extern void vgHelgrind_deleteWordSetU(WordSetU * ) ;
3928 extern UWord vgHelgrind_cardinalityWSU(WordSetU * ) ;   3928 extern UWord vgHelgrind_cardinalityWSU(WordSetU * ) ;
3929 extern void vgHelgrind_ppWSUstats(WordSetU *wsu , HChar *name ) ;   3929 extern void vgHelgrind_ppWSUstats(WordSetU *wsu , HChar *name ) ;
3930 extern WordSet vgHelgrind_emptyWS(WordSetU * ) ;   3930 extern WordSet vgHelgrind_emptyWS(WordSetU * ) ;
3931 extern WordSet vgHelgrind_addToWS(WordSetU * , WordSet  , UWord  ) ;   3931 extern WordSet vgHelgrind_addToWS(WordSetU * , WordSet  , UWord  ) ;
3932 extern WordSet vgHelgrind_delFromWS(WordSetU * , WordSet  , UWord  ) ;   3932 extern WordSet vgHelgrind_delFromWS(WordSetU * , WordSet  , UWord  ) ;
3933 extern WordSet vgHelgrind_unionWS(WordSetU * , WordSet  , WordSet  ) ;   3933 extern WordSet vgHelgrind_unionWS(WordSetU * , WordSet  , WordSet  ) ;
3934 extern WordSet vgHelgrind_intersectWS(WordSetU * , WordSet  , WordSet  ) ;   3934 extern WordSet vgHelgrind_intersectWS(WordSetU * , WordSet  , WordSet  ) ;
3935 extern WordSet vgHelgrind_minusWS(WordSetU * , WordSet  , WordSet  ) ;   3935 extern WordSet vgHelgrind_minusWS(WordSetU * , WordSet  , WordSet  ) ;
3936 extern Bool vgHelgrind_isEmptyWS(WordSetU * , WordSet  ) ;   3936 extern Bool vgHelgrind_isEmptyWS(WordSetU * , WordSet  ) ;
3937 extern Bool vgHelgrind_isSingletonWS(WordSetU * , WordSet  , UWord  ) ;   3937 extern Bool vgHelgrind_isSingletonWS(WordSetU * , WordSet  , UWord  ) ;
3938 extern UWord vgHelgrind_anyElementOfWS(WordSetU * , WordSet  ) ;   3938 extern UWord vgHelgrind_anyElementOfWS(WordSetU * , WordSet  ) ;
3939 extern UWord vgHelgrind_cardinalityWS(WordSetU * , WordSet  ) ;   3939 extern UWord vgHelgrind_cardinalityWS(WordSetU * , WordSet  ) ;
3940 extern Bool vgHelgrind_elemWS(WordSetU * , WordSet  , UWord  ) ;   3940 extern Bool vgHelgrind_elemWS(WordSetU * , WordSet  , UWord  ) ;
3941 extern WordSet vgHelgrind_doubletonWS(WordSetU * , UWord  , UWord  ) ;   3941 extern WordSet vgHelgrind_doubletonWS(WordSetU * , UWord  , UWord  ) ;
3942 extern WordSet vgHelgrind_singletonWS(WordSetU * , UWord  ) ;   3942 extern WordSet vgHelgrind_singletonWS(WordSetU * , UWord  ) ;
3943 extern WordSet vgHelgrind_isSubsetOf(WordSetU * , WordSet  , WordSet  ) ;   3943 extern WordSet vgHelgrind_isSubsetOf(WordSetU * , WordSet  , WordSet  ) ;
3944 extern Bool vgHelgrind_plausibleWS(WordSetU * , WordSet  ) ;   3944 extern Bool vgHelgrind_plausibleWS(WordSetU * , WordSet  ) ;
3945 extern Bool vgHelgrind_saneWS_SLOW(WordSetU * , WordSet  ) ;   3945 extern Bool vgHelgrind_saneWS_SLOW(WordSetU * , WordSet  ) ;
3946 extern void vgHelgrind_ppWS(WordSetU * , WordSet  ) ;   3946 extern void vgHelgrind_ppWS(WordSetU * , WordSet  ) ;
3947 extern void vgHelgrind_getPayloadWS(UWord **words , UWord *nWords , WordSetU * ,   3947 extern void vgHelgrind_getPayloadWS(UWord **words , UWord *nWords , WordSetU * ,
3948                                     WordSet  ) ;   3948                                     WordSet  ) ;
3949 extern Bool vgHelgrind_is_sane_Thread(Thread *thr ) ;   3949 extern Bool vgHelgrind_is_sane_Thread(Thread *thr ) ;
3950 extern Bool vgHelgrind_is_sane_LockP(Lock *lock ) ;   3950 extern Bool vgHelgrind_is_sane_LockP(Lock *lock ) ;
3951 extern Bool vgHelgrind_is_sane_LockN(Lock *lock ) ;   3951 extern Bool vgHelgrind_is_sane_LockN(Lock *lock ) ;
3952 extern Bool vgHelgrind_is_sane_LockNorP(Lock *lock ) ;   3952 extern Bool vgHelgrind_is_sane_LockNorP(Lock *lock ) ;
3953 extern Bool vgHelgrind_eq_Error(VgRes not_used , Error *e1 , Error *e2 ) ;   3953 extern Bool vgHelgrind_eq_Error(VgRes not_used , Error *e1 , Error *e2 ) ;
3954 extern void vgHelgrind_before_pp_Error(Error *err ) ;   3954 extern void vgHelgrind_before_pp_Error(Error *err ) ;
3955 extern void vgHelgrind_pp_Error(Error *err ) ;   3955 extern void vgHelgrind_pp_Error(Error *err ) ;
3956 extern UInt vgHelgrind_update_extra(Error *err ) ;   3956 extern UInt vgHelgrind_update_extra(Error *err ) ;
3957 extern Bool vgHelgrind_recognised_suppression(Char *name , Supp *su ) ;   3957 extern Bool vgHelgrind_recognised_suppression(Char *name , Supp *su ) ;
3958 extern Bool vgHelgrind_read_extra_suppression_info(Int fd , Char **bufpp ,   3958 extern Bool vgHelgrind_read_extra_suppression_info(Int fd , Char **bufpp ,
3959                                                    SizeT *nBufp , Supp *su ) ;   3959                                                    SizeT *nBufp , Supp *su ) ;
3960 extern Bool vgHelgrind_error_matches_suppression(Error *err , Supp *su ) ;   3960 extern Bool vgHelgrind_error_matches_suppression(Error *err , Supp *su ) ;
3961 extern Char *vgHelgrind_get_error_name(Error *err ) ;   3961 extern Char *vgHelgrind_get_error_name(Error *err ) ;
3962 extern Bool vgHelgrind_get_extra_suppression_info(Error *err , Char *buf ,   3962 extern Bool vgHelgrind_get_extra_suppression_info(Error *err , Char *buf ,
3963                                                   Int nBuf ) ;   3963                                                   Int nBuf ) ;
3964 extern void vgHelgrind_record_error_Race(Thread *thr , Addr data_addr ,   3964 extern void vgHelgrind_record_error_Race(Thread *thr , Addr data_addr ,
3965                                          Int szB , Bool isWrite ,   3965                                          Int szB , Bool isWrite ,
3966                                          Thread *h1_confthr ,   3966                                          Thread *h1_confthr ,
3967                                          ExeContext *h1_ct_segstart ,   3967                                          ExeContext *h1_ct_segstart ,
3968                                          ExeContext *h1_ct_mbsegend ) ;   3968                                          ExeContext *h1_ct_mbsegend ) ;
3969 extern void vgHelgrind_record_error_UnlockUnlocked(Thread * , Lock * ) ;   3969 extern void vgHelgrind_record_error_UnlockUnlocked(Thread * , Lock * ) ;
3970 extern void vgHelgrind_record_error_UnlockForeign(Thread * , Thread * , Lock * ) ;   3970 extern void vgHelgrind_record_error_UnlockForeign(Thread * , Thread * , Lock * ) ;
3971 extern void vgHelgrind_record_error_UnlockBogus(Thread * , Addr  ) ;   3971 extern void vgHelgrind_record_error_UnlockBogus(Thread * , Addr  ) ;
3972 extern void vgHelgrind_record_error_PthAPIerror(Thread * , HChar * , Word  ,   3972 extern void vgHelgrind_record_error_PthAPIerror(Thread * , HChar * , Word  ,
3973                                                 HChar * ) ;   3973                                                 HChar * ) ;
3974 extern void vgHelgrind_record_error_LockOrder(Thread * , Addr  , Addr  ,   3974 extern void vgHelgrind_record_error_LockOrder(Thread * , Addr  , Addr  ,
3975                                               ExeContext * , ExeContext * ) ;   3975                                               ExeContext * , ExeContext * ) ;
3976 extern void vgHelgrind_record_error_Misc_w_aux(Thread * , HChar *errstr ,   3976 extern void vgHelgrind_record_error_Misc_w_aux(Thread * , HChar *errstr ,
3977                                                HChar *auxstr ,   3977                                                HChar *auxstr ,
3978                                                ExeContext *auxctx ) ;   3978                                                ExeContext *auxctx ) ;
3979 extern void vgHelgrind_record_error_Misc(Thread *thr , HChar *errstr ) ;   3979 extern void vgHelgrind_record_error_Misc(Thread *thr , HChar *errstr ) ;
3980 extern ULong vgHelgrind_stats__LockN_to_P_queries ;   3980 extern ULong vgHelgrind_stats__LockN_to_P_queries ;
3981 extern ULong vgHelgrind_stats__LockN_to_P_get_map_size(void) ;   3981 extern ULong vgHelgrind_stats__LockN_to_P_get_map_size(void) ;
3982 extern ULong vgHelgrind_stats__string_table_queries ;   3982 extern ULong vgHelgrind_stats__string_table_queries ;
3983 extern ULong vgHelgrind_stats__string_table_get_map_size(void) ;   3983 extern ULong vgHelgrind_stats__string_table_get_map_size(void) ;
3984 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,   3984 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,
3985                                          SizeT *szB , Addr data_addr ) ;   3985                                          SizeT *szB , Addr data_addr ) ;
3986 extern Thr *libhb_init(void (*get_stacktrace)(Thr * , Addr * , UWord  ) ,   3986 extern Thr *libhb_init(void (*get_stacktrace)(Thr * , Addr * , UWord  ) ,
3987                        ExeContext *(*get_EC)(Thr * ) ) ;   3987                        ExeContext *(*get_EC)(Thr * ) ) ;
3988 extern void libhb_shutdown(Bool show_stats ) ;   3988 extern void libhb_shutdown(Bool show_stats ) ;
3989 extern Thr *libhb_create(Thr *parent ) ;   3989 extern Thr *libhb_create(Thr *parent ) ;
3990 extern void libhb_async_exit(Thr *exitter ) ;   3990 extern void libhb_async_exit(Thr *exitter ) ;
3991 extern SO *libhb_so_alloc(void) ;   3991 extern SO *libhb_so_alloc(void) ;
3992 extern void libhb_so_dealloc(SO *so ) ;   3992 extern void libhb_so_dealloc(SO *so ) ;
3993 extern void libhb_so_send(Thr *thr , SO *so , Bool strong_send ) ;   3993 extern void libhb_so_send(Thr *thr , SO *so , Bool strong_send ) ;
3994 extern void libhb_so_recv(Thr *thr , SO *so , Bool strong_recv ) ;   3994 extern void libhb_so_recv(Thr *thr , SO *so , Bool strong_recv ) ;
3995 extern Bool libhb_so_everSent(SO *so ) ;   3995 extern Bool libhb_so_everSent(SO *so ) ;
3996 extern void zsm_sapply08_f__msmcwrite(Thr *thr , Addr a ) ;   3996 extern void zsm_sapply08_f__msmcwrite(Thr *thr , Addr a ) ;
3997 extern void zsm_sapply16_f__msmcwrite(Thr *thr , Addr a ) ;   3997 extern void zsm_sapply16_f__msmcwrite(Thr *thr , Addr a ) ;
3998 extern void zsm_sapply32_f__msmcwrite(Thr *thr , Addr a ) ;   3998 extern void zsm_sapply32_f__msmcwrite(Thr *thr , Addr a ) ;
3999 extern void zsm_sapply64_f__msmcwrite(Thr *thr , Addr a ) ;   3999 extern void zsm_sapply64_f__msmcwrite(Thr *thr , Addr a ) ;
4000 extern void zsm_sapplyNN_f__msmcwrite(Thr *thr , Addr a , SizeT len ) ;   4000 extern void zsm_sapplyNN_f__msmcwrite(Thr *thr , Addr a , SizeT len ) ;
4001 extern void zsm_sapply08_f__msmcread(Thr *thr , Addr a ) ;   4001 extern void zsm_sapply08_f__msmcread(Thr *thr , Addr a ) ;
4002 extern void zsm_sapply16_f__msmcread(Thr *thr , Addr a ) ;   4002 extern void zsm_sapply16_f__msmcread(Thr *thr , Addr a ) ;
4003 extern void zsm_sapply32_f__msmcread(Thr *thr , Addr a ) ;   4003 extern void zsm_sapply32_f__msmcread(Thr *thr , Addr a ) ;
4004 extern void zsm_sapply64_f__msmcread(Thr *thr , Addr a ) ;   4004 extern void zsm_sapply64_f__msmcread(Thr *thr , Addr a ) ;
4005 extern void zsm_sapplyNN_f__msmcread(Thr *thr , Addr a , SizeT len ) ;   4005 extern void zsm_sapplyNN_f__msmcread(Thr *thr , Addr a , SizeT len ) ;
4006 extern void libhb_Thr_resumes(Thr *thr ) ;   4006 extern void libhb_Thr_resumes(Thr *thr ) ;
4007 extern void libhb_srange_new(Thr * , Addr  , SizeT  ) ;   4007 extern void libhb_srange_new(Thr * , Addr  , SizeT  ) ;
4008 extern void libhb_srange_noaccess(Thr * , Addr  , SizeT  ) ;   4008 extern void libhb_srange_noaccess(Thr * , Addr  , SizeT  ) ;
4009 extern void libhb_srange_untrack(Thr * , Addr  , SizeT  ) ;   4009 extern void libhb_srange_untrack(Thr * , Addr  , SizeT  ) ;
4010 extern void *libhb_get_Thr_hgthread(Thr * ) ;   4010 extern void *libhb_get_Thr_hgthread(Thr * ) ;
4011 extern void libhb_set_Thr_hgthread(Thr * , void * ) ;   4011 extern void libhb_set_Thr_hgthread(Thr * , void * ) ;
4012 extern void libhb_copy_shadow_state(Thr *thr , Addr src , Addr dst , SizeT len ) ;   4012 extern void libhb_copy_shadow_state(Thr *thr , Addr src , Addr dst , SizeT len ) ;
4013 extern void libhb_maybe_GC(void) ;   4013 extern void libhb_maybe_GC(void) ;
4014 extern Bool libhb_event_map_lookup(ExeContext **resEC , Thr **resThr ,   4014 extern Bool libhb_event_map_lookup(ExeContext **resEC , Thr **resThr ,
4015                                    SizeT *resSzB , Bool *resIsW , Thr *thr ,   4015                                    SizeT *resSzB , Bool *resIsW , Thr *thr ,
4016                                    Addr a , SizeT szB , Bool isW ) ;   4016                                    Addr a , SizeT szB , Bool isW ) ;
4017 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format   4017 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format
4018                                                       , ...)  __attribute__((__unused__)) ;   4018                                                       , ...)  __attribute__((__unused__)) ;
4019 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format   4019 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format
4020                                                       , ...)  __attribute__((__unused__)) ;   4020                                                       , ...)  __attribute__((__unused__)) ;
4021 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format   4021 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format
4022                                                       , ...)   4022                                                       , ...)
4023 {   4023 {
4024   unsigned long _qzz_res ;   4024   unsigned long _qzz_res ;
4025   va_list vargs ;   4025   va_list vargs ;
4026   unsigned int volatile   _zzq_args[6] ;   4026   unsigned int volatile   _zzq_args[6] ;
4027   unsigned int volatile   _zzq_result ;   4027   unsigned int volatile   _zzq_result ;
4028     4028  
4029   {   4029   {
4030   __builtin_va_start(vargs, format);   4030   __builtin_va_start(vargs, format);
4031   _zzq_args[0] = (unsigned int volatile   )5123U;   4031   _zzq_args[0] = (unsigned int volatile   )5123U;
4032   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));   4032   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));
4033   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));   4033   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));
4034   _zzq_args[3] = (unsigned int volatile   )0U;   4034   _zzq_args[3] = (unsigned int volatile   )0U;
4035   _zzq_args[4] = (unsigned int volatile   )0U;   4035   _zzq_args[4] = (unsigned int volatile   )0U;
4036   _zzq_args[5] = (unsigned int volatile   )0U;   4036   _zzq_args[5] = (unsigned int volatile   )0U;
4037   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"   4037   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"
4038                        "roll $29, %%edi ; roll $19, %%edi\n\t"   4038                        "roll $29, %%edi ; roll $19, %%edi\n\t"
4039                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),   4039                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),
4040                        "0" (0): "cc", "memory");   4040                        "0" (0): "cc", "memory");
4041   _qzz_res = (unsigned long )_zzq_result;   4041   _qzz_res = (unsigned long )_zzq_result;
4042   __builtin_va_end(vargs);   4042   __builtin_va_end(vargs);
4043   return ((int )_qzz_res);   4043   return ((int )_qzz_res);
4044 }   4044 }
4045 }   4045 }
4046 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format   4046 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format
4047                                                                 , ...)  __attribute__((__unused__)) ;   4047                                                                 , ...)  __attribute__((__unused__)) ;
4048 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format   4048 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format
4049                                                                 , ...)  __attribute__((__unused__)) ;   4049                                                                 , ...)  __attribute__((__unused__)) ;
4050 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format   4050 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format
4051                                                                 , ...)   4051                                                                 , ...)
4052 {   4052 {
4053   unsigned long _qzz_res ;   4053   unsigned long _qzz_res ;
4054   va_list vargs ;   4054   va_list vargs ;
4055   unsigned int volatile   _zzq_args[6] ;   4055   unsigned int volatile   _zzq_args[6] ;
4056   unsigned int volatile   _zzq_result ;   4056   unsigned int volatile   _zzq_result ;
4057     4057  
4058   {   4058   {
4059   __builtin_va_start(vargs, format);   4059   __builtin_va_start(vargs, format);
4060   _zzq_args[0] = (unsigned int volatile   )5124U;   4060   _zzq_args[0] = (unsigned int volatile   )5124U;
4061   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));   4061   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));
4062   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));   4062   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));
4063   _zzq_args[3] = (unsigned int volatile   )0U;   4063   _zzq_args[3] = (unsigned int volatile   )0U;
4064   _zzq_args[4] = (unsigned int volatile   )0U;   4064   _zzq_args[4] = (unsigned int volatile   )0U;
4065   _zzq_args[5] = (unsigned int volatile   )0U;   4065   _zzq_args[5] = (unsigned int volatile   )0U;
4066   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"   4066   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"
4067                        "roll $29, %%edi ; roll $19, %%edi\n\t"   4067                        "roll $29, %%edi ; roll $19, %%edi\n\t"
4068                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),   4068                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),
4069                        "0" (0): "cc", "memory");   4069                        "0" (0): "cc", "memory");
4070   _qzz_res = (unsigned long )_zzq_result;   4070   _qzz_res = (unsigned long )_zzq_result;
4071   __builtin_va_end(vargs);   4071   __builtin_va_end(vargs);
4072   return ((int )_qzz_res);   4072   return ((int )_qzz_res);
4073 }   4073 }
4074 }   4074 }
4075 static void all__sanity_check(Char *who ) ;   4075 static void all__sanity_check(Char *who ) ;
4076 static Thread *admin_threads  =    (Thread *)((void *)0);   4076 static Thread *admin_threads  =    (Thread *)((void *)0);
4077 static Lock *admin_locks  =    (Lock *)((void *)0);   4077 static Lock *admin_locks  =    (Lock *)((void *)0);
4078 static Thread **map_threads  =    (Thread **)((void *)0);   4078 static Thread **map_threads  =    (Thread **)((void *)0);
4079 static WordFM *map_locks  =    (WordFM *)((void *)0);   4079 static WordFM *map_locks  =    (WordFM *)((void *)0);
4080 static WordSetU *univ_tsets  =    (WordSetU *)((void *)0);   4080 static WordSetU *univ_tsets  =    (WordSetU *)((void *)0);
4081 static WordSetU *univ_lsets  =    (WordSetU *)((void *)0);   4081 static WordSetU *univ_lsets  =    (WordSetU *)((void *)0);
4082 static WordSetU *univ_laog  =    (WordSetU *)((void *)0);   4082 static WordSetU *univ_laog  =    (WordSetU *)((void *)0);
4083 static UWord stats__lockN_acquires  =    (UWord )0;   4083 static UWord stats__lockN_acquires  =    (UWord )0;
4084 static UWord stats__lockN_releases  =    (UWord )0;   4084 static UWord stats__lockN_releases  =    (UWord )0;
4085 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr ) ;   4085 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr ) ;
4086 static Thread *mk_Thread(Thr *hbthr ) ;   4086 static Thread *mk_Thread(Thr *hbthr ) ;
4087 static Int indx  =    1;   4087 static Int indx  =    1;
4088 static Thread *mk_Thread(Thr *hbthr )   4088 static Thread *mk_Thread(Thr *hbthr )
4089 {   4089 {
4090   Thread *thread ;   4090   Thread *thread ;
4091   void *tmp ;   4091   void *tmp ;
4092   Int tmp___0 ;   4092   Int tmp___0 ;
4093     4093  
4094   {   4094   {
4095   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Thread.1", (SizeT )sizeof(Thread ));   4095   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Thread.1", (SizeT )sizeof(Thread ));
4096   thread = (Thread *)tmp;   4096   thread = (Thread *)tmp;
4097   thread->locksetA = vgHelgrind_emptyWS(univ_lsets);   4097   thread->locksetA = vgHelgrind_emptyWS(univ_lsets);
4098   thread->locksetW = vgHelgrind_emptyWS(univ_lsets);   4098   thread->locksetW = vgHelgrind_emptyWS(univ_lsets);
4099   thread->magic = (UInt )1347405285;   4099   thread->magic = (UInt )1347405285;
4100   thread->hbthr = hbthr;   4100   thread->hbthr = hbthr;
4101   thread->coretid = (ThreadId )0;   4101   thread->coretid = (ThreadId )0;
4102   thread->created_at = (ExeContext *)((void *)0);   4102   thread->created_at = (ExeContext *)((void *)0);
4103   thread->announced = (Bool )0;   4103   thread->announced = (Bool )0;
4104   tmp___0 = indx;   4104   tmp___0 = indx;
4105   indx ++;   4105   indx ++;
4106   thread->errmsg_index = tmp___0;   4106   thread->errmsg_index = tmp___0;
4107   thread->admin = admin_threads;   4107   thread->admin = admin_threads;
4108   admin_threads = thread;   4108   admin_threads = thread;
4109   return (thread);   4109   return (thread);
4110 }   4110 }
4111 }   4111 }
4112 static Lock *mk_LockN(LockKind kind , Addr guestaddr ) ;   4112 static Lock *mk_LockN(LockKind kind , Addr guestaddr ) ;
4113 static ULong unique  =    (ULong )0;   4113 static ULong unique  =    (ULong )0;
4114 static Lock *mk_LockN(LockKind kind , Addr guestaddr )   4114 static Lock *mk_LockN(LockKind kind , Addr guestaddr )
4115 {   4115 {
4116   Lock *lock ;   4116   Lock *lock ;
4117   void *tmp ;   4117   void *tmp ;
4118   ULong tmp___0 ;   4118   ULong tmp___0 ;
4119   Bool tmp___1 ;   4119   Bool tmp___1 ;
4120     4120  
4121   {   4121   {
4122   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Lock.1", (SizeT )sizeof(Lock ));   4122   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Lock.1", (SizeT )sizeof(Lock ));
4123   lock = (Lock *)tmp;   4123   lock = (Lock *)tmp;
4124   lock->admin_next = admin_locks;   4124   lock->admin_next = admin_locks;
4125   lock->admin_prev = (struct _Lock *)((void *)0);   4125   lock->admin_prev = (struct _Lock *)((void *)0);
4126   if (admin_locks) {   4126   if (admin_locks) {
4127     admin_locks->admin_prev = lock;   4127     admin_locks->admin_prev = lock;
4128   } else {   4128   } else {
4129     4129  
4130   }   4130   }
4131   admin_locks = lock;   4131   admin_locks = lock;
4132   tmp___0 = unique;   4132   tmp___0 = unique;
4133   unique ++;   4133   unique ++;
4134   lock->unique = tmp___0;   4134   lock->unique = tmp___0;
4135   lock->magic = (UInt )1699067223;   4135   lock->magic = (UInt )1699067223;
4136   lock->appeared_at = (ExeContext *)((void *)0);   4136   lock->appeared_at = (ExeContext *)((void *)0);
4137   lock->acquired_at = (ExeContext *)((void *)0);   4137   lock->acquired_at = (ExeContext *)((void *)0);
4138   lock->hbso = libhb_so_alloc();   4138   lock->hbso = libhb_so_alloc();
4139   lock->guestaddr = guestaddr;   4139   lock->guestaddr = guestaddr;
4140   lock->kind = kind;   4140   lock->kind = kind;
4141   lock->heldW = (Bool )0;   4141   lock->heldW = (Bool )0;
4142   lock->heldBy = (WordBag *)((void *)0);   4142   lock->heldBy = (WordBag *)((void *)0);
4143   tmp___1 = vgHelgrind_is_sane_LockN(lock);   4143   tmp___1 = vgHelgrind_is_sane_LockN(lock);
4144   if (tmp___1) {   4144   if (tmp___1) {
4145     4145  
4146   } else {   4146   } else {
4147     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   4147     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
4148                         (Char const   *)"hg_main.c", 188,   4148                         (Char const   *)"hg_main.c", 188,
4149                         (Char const   *)"mk_LockN", "");   4149                         (Char const   *)"mk_LockN", "");
4150   }   4150   }
4151   return (lock);   4151   return (lock);
4152 }   4152 }
4153 }   4153 }
4154 static void del_LockN(Lock *lk )   4154 static void del_LockN(Lock *lk )
4155 {   4155 {
4156   Bool tmp ;   4156   Bool tmp ;
4157     4157  
4158   {   4158   {
4159   tmp = vgHelgrind_is_sane_LockN(lk);   4159   tmp = vgHelgrind_is_sane_LockN(lk);
4160   if (tmp) {   4160   if (tmp) {
4161     4161  
4162   } else {   4162   } else {
4163     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4163     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4164                         (Char const   *)"hg_main.c", 196,   4164                         (Char const   *)"hg_main.c", 196,
4165                         (Char const   *)"del_LockN", "");   4165                         (Char const   *)"del_LockN", "");
4166   }   4166   }
4167   if (lk->hbso) {   4167   if (lk->hbso) {
4168     4168  
4169   } else {   4169   } else {
4170     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",   4170     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",
4171                         (Char const   *)"hg_main.c", 197,   4171                         (Char const   *)"hg_main.c", 197,
4172                         (Char const   *)"del_LockN", "");   4172                         (Char const   *)"del_LockN", "");
4173   }   4173   }
4174   libhb_so_dealloc(lk->hbso);   4174   libhb_so_dealloc(lk->hbso);
4175   if (lk->heldBy) {   4175   if (lk->heldBy) {
4176     vgPlain_deleteBag(lk->heldBy);   4176     vgPlain_deleteBag(lk->heldBy);
4177   } else {   4177   } else {
4178     4178  
4179   }   4179   }
4180   if ((unsigned int )admin_locks == (unsigned int )lk) {   4180   if ((unsigned int )admin_locks == (unsigned int )lk) {
4181     admin_locks = lk->admin_next;   4181     admin_locks = lk->admin_next;
4182     if (admin_locks) {   4182     if (admin_locks) {
4183       admin_locks->admin_prev = (struct _Lock *)((void *)0);   4183       admin_locks->admin_prev = (struct _Lock *)((void *)0);
4184     } else {   4184     } else {
4185     4185  
4186     }   4186     }
4187   } else {   4187   } else {
4188     (lk->admin_prev)->admin_next = lk->admin_next;   4188     (lk->admin_prev)->admin_next = lk->admin_next;
4189     (lk->admin_next)->admin_prev = lk->admin_prev;   4189     (lk->admin_next)->admin_prev = lk->admin_prev;
4190   }   4190   }
4191   vgPlain_memset((void *)lk, 170, (SizeT )sizeof(*lk));   4191   vgPlain_memset((void *)lk, 170, (SizeT )sizeof(*lk));
4192   vgHelgrind_free((void *)lk);   4192   vgHelgrind_free((void *)lk);
4193   return;   4193   return;
4194 }   4194 }
4195 }   4195 }
4196 static void lockN_acquire_writer(Lock *lk , Thread *thr )   4196 static void lockN_acquire_writer(Lock *lk , Thread *thr )
4197 {   4197 {
4198   Bool tmp ;   4198   Bool tmp ;
4199   Bool tmp___0 ;   4199   Bool tmp___0 ;
4200   ThreadId tid ;   4200   ThreadId tid ;
4201   UWord tmp___1 ;   4201   UWord tmp___1 ;
4202   UWord tmp___2 ;   4202   UWord tmp___2 ;
4203   UWord tmp___3 ;   4203   UWord tmp___3 ;
4204   Bool tmp___4 ;   4204   Bool tmp___4 ;
4205     4205  
4206   {   4206   {
4207   tmp = vgHelgrind_is_sane_LockN(lk);   4207   tmp = vgHelgrind_is_sane_LockN(lk);
4208   if (tmp) {   4208   if (tmp) {
4209     4209  
4210   } else {   4210   } else {
4211     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4211     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4212                         (Char const   *)"hg_main.c", 220,   4212                         (Char const   *)"hg_main.c", 220,
4213                         (Char const   *)"lockN_acquire_writer", "");   4213                         (Char const   *)"lockN_acquire_writer", "");
4214   }   4214   }
4215   tmp___0 = vgHelgrind_is_sane_Thread(thr);   4215   tmp___0 = vgHelgrind_is_sane_Thread(thr);
4216   if (tmp___0) {   4216   if (tmp___0) {
4217     4217  
4218   } else {   4218   } else {
4219     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4219     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4220                         (Char const   *)"hg_main.c", 221,   4220                         (Char const   *)"hg_main.c", 221,
4221                         (Char const   *)"lockN_acquire_writer", "");   4221                         (Char const   *)"lockN_acquire_writer", "");
4222   }   4222   }
4223   stats__lockN_acquires ++;   4223   stats__lockN_acquires ++;
4224   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {   4224   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {
4225     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4225     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4226     4226  
4227     } else {   4227     } else {
4228       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",   4228       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",
4229                           (Char const   *)"hg_main.c", 230,   4229                           (Char const   *)"hg_main.c", 230,
4230                           (Char const   *)"lockN_acquire_writer", "");   4230                           (Char const   *)"lockN_acquire_writer", "");
4231     }   4231     }
4232     tid = map_threads_maybe_reverse_lookup_SLOW(thr);   4232     tid = map_threads_maybe_reverse_lookup_SLOW(thr);
4233     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);   4233     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);
4234   } else   4234   } else
4235   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   4235   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
4236     4236  
4237   } else {   4237   } else {
4238     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",   4238     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",
4239                         (Char const   *)"hg_main.c", 235,   4239                         (Char const   *)"hg_main.c", 235,
4240                         (Char const   *)"lockN_acquire_writer", "");   4240                         (Char const   *)"lockN_acquire_writer", "");
4241   }   4241   }
4242   switch ((unsigned int )lk->kind) {   4242   switch ((unsigned int )lk->kind) {
4243   case_LK_nonRec:   4243   case_LK_nonRec:
4244   case 1002U:   4244   case 1002U:
4245   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4245   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4246     4246  
4247   } else {   4247   } else {
4248     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",   4248     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",
4249                         (Char const   *)"hg_main.c", 242,   4249                         (Char const   *)"hg_main.c", 242,
4250                         (Char const   *)"lockN_acquire_writer", "");   4250                         (Char const   *)"lockN_acquire_writer", "");
4251   }   4251   }
4252   if (! lk->heldW) {   4252   if (! lk->heldW) {
4253     4253  
4254   } else {   4254   } else {
4255     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   4255     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
4256                         (Char const   *)"hg_main.c", 243,   4256                         (Char const   *)"hg_main.c", 243,
4257                         (Char const   *)"lockN_acquire_writer", "");   4257                         (Char const   *)"lockN_acquire_writer", "");
4258   }   4258   }
4259   lk->heldW = (Bool )1;   4259   lk->heldW = (Bool )1;
4260   lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNaw.1",   4260   lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNaw.1",
4261                               & vgHelgrind_free);   4261                               & vgHelgrind_free);
4262   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4262   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4263   break;   4263   break;
4264   case 1001U:   4264   case 1001U:
4265   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4265   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4266     goto case_LK_nonRec;   4266     goto case_LK_nonRec;
4267   } else {   4267   } else {
4268     4268  
4269   }   4269   }
4270   if (lk->heldW) {   4270   if (lk->heldW) {
4271     4271  
4272   } else {   4272   } else {
4273     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldW",   4273     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldW",
4274                         (Char const   *)"hg_main.c", 252,   4274                         (Char const   *)"hg_main.c", 252,
4275                         (Char const   *)"lockN_acquire_writer", "");   4275                         (Char const   *)"lockN_acquire_writer", "");
4276   }   4276   }
4277   tmp___1 = vgPlain_sizeUniqueBag(lk->heldBy);   4277   tmp___1 = vgPlain_sizeUniqueBag(lk->heldBy);
4278   if (tmp___1 == 1UL) {   4278   if (tmp___1 == 1UL) {
4279     4279  
4280   } else {   4280   } else {
4281     vgPlain_assert_fail((Bool )0,   4281     vgPlain_assert_fail((Bool )0,
4282                         (Char const   *)"VG_(sizeUniqueBag(lk->heldBy)) == 1",   4282                         (Char const   *)"VG_(sizeUniqueBag(lk->heldBy)) == 1",
4283                         (Char const   *)"hg_main.c", 254,   4283                         (Char const   *)"hg_main.c", 254,
4284                         (Char const   *)"lockN_acquire_writer", "");   4284                         (Char const   *)"lockN_acquire_writer", "");
4285   }   4285   }
4286   tmp___2 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   4286   tmp___2 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
4287   tmp___3 = vgPlain_sizeTotalBag(lk->heldBy);   4287   tmp___3 = vgPlain_sizeTotalBag(lk->heldBy);
4288   if (tmp___2 == tmp___3) {   4288   if (tmp___2 == tmp___3) {
4289     4289  
4290   } else {   4290   } else {
4291     vgPlain_assert_fail((Bool )0,   4291     vgPlain_assert_fail((Bool )0,
4292                         (Char const   *)"VG_(elemBag)(lk->heldBy, (Word)thr) == VG_(sizeTotalBag)(lk->heldBy)",   4292                         (Char const   *)"VG_(elemBag)(lk->heldBy, (Word)thr) == VG_(sizeTotalBag)(lk->heldBy)",
4293                         (Char const   *)"hg_main.c", 257,   4293                         (Char const   *)"hg_main.c", 257,
4294                         (Char const   *)"lockN_acquire_writer", "");   4294                         (Char const   *)"lockN_acquire_writer", "");
4295   }   4295   }
4296   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4296   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4297   break;   4297   break;
4298   case 1003U:   4298   case 1003U:
4299   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4299   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4300     if (! lk->heldW) {   4300     if (! lk->heldW) {
4301     4301  
4302     } else {   4302     } else {
4303       vgPlain_assert_fail((Bool )0,   4303       vgPlain_assert_fail((Bool )0,
4304                           (Char const   *)"lk->heldBy == NULL && !lk->heldW",   4304                           (Char const   *)"lk->heldBy == NULL && !lk->heldW",
4305                           (Char const   *)"hg_main.c", 261,   4305                           (Char const   *)"hg_main.c", 261,
4306                           (Char const   *)"lockN_acquire_writer", "");   4306                           (Char const   *)"lockN_acquire_writer", "");
4307     }   4307     }
4308   } else {   4308   } else {
4309     vgPlain_assert_fail((Bool )0,   4309     vgPlain_assert_fail((Bool )0,
4310                         (Char const   *)"lk->heldBy == NULL && !lk->heldW",   4310                         (Char const   *)"lk->heldBy == NULL && !lk->heldW",
4311                         (Char const   *)"hg_main.c", 261,   4311                         (Char const   *)"hg_main.c", 261,
4312                         (Char const   *)"lockN_acquire_writer", "");   4312                         (Char const   *)"lockN_acquire_writer", "");
4313   }   4313   }
4314   goto case_LK_nonRec;   4314   goto case_LK_nonRec;
4315   default:   4315   default:
4316   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   4316   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
4317                       (Char const   *)"hg_main.c", 264,   4317                       (Char const   *)"hg_main.c", 264,
4318                       (Char const   *)"lockN_acquire_writer", "");   4318                       (Char const   *)"lockN_acquire_writer", "");
4319   }   4319   }
4320   tmp___4 = vgHelgrind_is_sane_LockN(lk);   4320   tmp___4 = vgHelgrind_is_sane_LockN(lk);
4321   if (tmp___4) {   4321   if (tmp___4) {
4322     4322  
4323   } else {   4323   } else {
4324     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4324     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4325                         (Char const   *)"hg_main.c", 266,   4325                         (Char const   *)"hg_main.c", 266,
4326                         (Char const   *)"lockN_acquire_writer", "");   4326                         (Char const   *)"lockN_acquire_writer", "");
4327   }   4327   }
4328   return;   4328   return;
4329 }   4329 }
4330 }   4330 }
4331 static void lockN_acquire_reader(Lock *lk , Thread *thr )   4331 static void lockN_acquire_reader(Lock *lk , Thread *thr )
4332 {   4332 {
4333   Bool tmp ;   4333   Bool tmp ;
4334   Bool tmp___0 ;   4334   Bool tmp___0 ;
4335   ThreadId tid ;   4335   ThreadId tid ;
4336   Bool tmp___1 ;   4336   Bool tmp___1 ;
4337     4337  
4338   {   4338   {
4339   tmp = vgHelgrind_is_sane_LockN(lk);   4339   tmp = vgHelgrind_is_sane_LockN(lk);
4340   if (tmp) {   4340   if (tmp) {
4341     4341  
4342   } else {   4342   } else {
4343     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4343     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4344                         (Char const   *)"hg_main.c", 271,   4344                         (Char const   *)"hg_main.c", 271,
4345                         (Char const   *)"lockN_acquire_reader", "");   4345                         (Char const   *)"lockN_acquire_reader", "");
4346   }   4346   }
4347   tmp___0 = vgHelgrind_is_sane_Thread(thr);   4347   tmp___0 = vgHelgrind_is_sane_Thread(thr);
4348   if (tmp___0) {   4348   if (tmp___0) {
4349     4349  
4350   } else {   4350   } else {
4351     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4351     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4352                         (Char const   *)"hg_main.c", 272,   4352                         (Char const   *)"hg_main.c", 272,
4353                         (Char const   *)"lockN_acquire_reader", "");   4353                         (Char const   *)"lockN_acquire_reader", "");
4354   }   4354   }
4355   if ((unsigned int )lk->kind == 1003U) {   4355   if ((unsigned int )lk->kind == 1003U) {
4356     4356  
4357   } else {   4357   } else {
4358     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->kind == LK_rdwr",   4358     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->kind == LK_rdwr",
4359                         (Char const   *)"hg_main.c", 274,   4359                         (Char const   *)"hg_main.c", 274,
4360                         (Char const   *)"lockN_acquire_reader", "");   4360                         (Char const   *)"lockN_acquire_reader", "");
4361   }   4361   }
4362   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4362   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4363     4363  
4364   } else   4364   } else
4365   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   4365   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
4366     if (! lk->heldW) {   4366     if (! lk->heldW) {
4367     4367  
4368     } else {   4368     } else {
4369       vgPlain_assert_fail((Bool )0,   4369       vgPlain_assert_fail((Bool )0,
4370                           (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",   4370                           (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",
4371                           (Char const   *)"hg_main.c", 277,   4371                           (Char const   *)"hg_main.c", 277,
4372                           (Char const   *)"lockN_acquire_reader", "");   4372                           (Char const   *)"lockN_acquire_reader", "");
4373     }   4373     }
4374   } else {   4374   } else {
4375     vgPlain_assert_fail((Bool )0,   4375     vgPlain_assert_fail((Bool )0,
4376                         (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",   4376                         (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",
4377                         (Char const   *)"hg_main.c", 277,   4377                         (Char const   *)"hg_main.c", 277,
4378                         (Char const   *)"lockN_acquire_reader", "");   4378                         (Char const   *)"lockN_acquire_reader", "");
4379   }   4379   }
4380   stats__lockN_acquires ++;   4380   stats__lockN_acquires ++;
4381   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {   4381   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {
4382     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4382     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4383     4383  
4384     } else {   4384     } else {
4385       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",   4385       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",
4386                           (Char const   *)"hg_main.c", 286,   4386                           (Char const   *)"hg_main.c", 286,
4387                           (Char const   *)"lockN_acquire_reader", "");   4387                           (Char const   *)"lockN_acquire_reader", "");
4388     }   4388     }
4389     tid = map_threads_maybe_reverse_lookup_SLOW(thr);   4389     tid = map_threads_maybe_reverse_lookup_SLOW(thr);
4390     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);   4390     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);
4391   } else   4391   } else
4392   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   4392   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
4393     4393  
4394   } else {   4394   } else {
4395     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",   4395     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",
4396                         (Char const   *)"hg_main.c", 291,   4396                         (Char const   *)"hg_main.c", 291,
4397                         (Char const   *)"lockN_acquire_reader", "");   4397                         (Char const   *)"lockN_acquire_reader", "");
4398   }   4398   }
4399   if (lk->heldBy) {   4399   if (lk->heldBy) {
4400     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4400     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4401   } else {   4401   } else {
4402     lk->heldW = (Bool )0;   4402     lk->heldW = (Bool )0;
4403     lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNar.1",   4403     lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNar.1",
4404                                 & vgHelgrind_free);   4404                                 & vgHelgrind_free);
4405     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4405     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4406   }   4406   }
4407   if (! lk->heldW) {   4407   if (! lk->heldW) {
4408     4408  
4409   } else {   4409   } else {
4410     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   4410     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
4411                         (Char const   *)"hg_main.c", 302,   4411                         (Char const   *)"hg_main.c", 302,
4412                         (Char const   *)"lockN_acquire_reader", "");   4412                         (Char const   *)"lockN_acquire_reader", "");
4413   }   4413   }
4414   tmp___1 = vgHelgrind_is_sane_LockN(lk);   4414   tmp___1 = vgHelgrind_is_sane_LockN(lk);
4415   if (tmp___1) {   4415   if (tmp___1) {
4416     4416  
4417   } else {   4417   } else {
4418     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4418     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4419                         (Char const   *)"hg_main.c", 303,   4419                         (Char const   *)"hg_main.c", 303,
4420                         (Char const   *)"lockN_acquire_reader", "");   4420                         (Char const   *)"lockN_acquire_reader", "");
4421   }   4421   }
4422   return;   4422   return;
4423 }   4423 }
4424 }   4424 }
4425 static void lockN_release(Lock *lk , Thread *thr )   4425 static void lockN_release(Lock *lk , Thread *thr )
4426 {   4426 {
4427   Bool b ;   4427   Bool b ;
4428   Bool tmp ;   4428   Bool tmp ;
4429   Bool tmp___0 ;   4429   Bool tmp___0 ;
4430   Bool tmp___1 ;   4430   Bool tmp___1 ;
4431   Bool tmp___2 ;   4431   Bool tmp___2 ;
4432     4432  
4433   {   4433   {
4434   tmp = vgHelgrind_is_sane_LockN(lk);   4434   tmp = vgHelgrind_is_sane_LockN(lk);
4435   if (tmp) {   4435   if (tmp) {
4436     4436  
4437   } else {   4437   } else {
4438     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4438     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4439                         (Char const   *)"hg_main.c", 313,   4439                         (Char const   *)"hg_main.c", 313,
4440                         (Char const   *)"lockN_release", "");   4440                         (Char const   *)"lockN_release", "");
4441   }   4441   }
4442   tmp___0 = vgHelgrind_is_sane_Thread(thr);   4442   tmp___0 = vgHelgrind_is_sane_Thread(thr);
4443   if (tmp___0) {   4443   if (tmp___0) {
4444     4444  
4445   } else {   4445   } else {
4446     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4446     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4447                         (Char const   *)"hg_main.c", 314,   4447                         (Char const   *)"hg_main.c", 314,
4448                         (Char const   *)"lockN_release", "");   4448                         (Char const   *)"lockN_release", "");
4449   }   4449   }
4450   if (lk->heldBy) {   4450   if (lk->heldBy) {
4451     4451  
4452   } else {   4452   } else {
4453     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",   4453     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",
4454                         (Char const   *)"hg_main.c", 316,   4454                         (Char const   *)"hg_main.c", 316,
4455                         (Char const   *)"lockN_release", "");   4455                         (Char const   *)"lockN_release", "");
4456   }   4456   }
4457   stats__lockN_releases ++;   4457   stats__lockN_releases ++;
4458   b = vgPlain_delFromBag(lk->heldBy, (UWord )((Word )thr));   4458   b = vgPlain_delFromBag(lk->heldBy, (UWord )((Word )thr));
4459   if (b) {   4459   if (b) {
4460     4460  
4461   } else {   4461   } else {
4462     vgPlain_assert_fail((Bool )0, (Char const   *)"b",   4462     vgPlain_assert_fail((Bool )0, (Char const   *)"b",
4463                         (Char const   *)"hg_main.c", 321,   4463                         (Char const   *)"hg_main.c", 321,
4464                         (Char const   *)"lockN_release", "");   4464                         (Char const   *)"lockN_release", "");
4465   }   4465   }
4466   if (lk->acquired_at) {   4466   if (lk->acquired_at) {
4467     4467  
4468   } else {   4468   } else {
4469     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",   4469     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",
4470                         (Char const   *)"hg_main.c", 323,   4470                         (Char const   *)"hg_main.c", 323,
4471                         (Char const   *)"lockN_release", "");   4471                         (Char const   *)"lockN_release", "");
4472   }   4472   }
4473   tmp___1 = vgPlain_isEmptyBag(lk->heldBy);   4473   tmp___1 = vgPlain_isEmptyBag(lk->heldBy);
4474   if (tmp___1) {   4474   if (tmp___1) {
4475     vgPlain_deleteBag(lk->heldBy);   4475     vgPlain_deleteBag(lk->heldBy);
4476     lk->heldBy = (WordBag *)((void *)0);   4476     lk->heldBy = (WordBag *)((void *)0);
4477     lk->heldW = (Bool )0;   4477     lk->heldW = (Bool )0;
4478     lk->acquired_at = (ExeContext *)((void *)0);   4478     lk->acquired_at = (ExeContext *)((void *)0);
4479   } else {   4479   } else {
4480     4480  
4481   }   4481   }
4482   tmp___2 = vgHelgrind_is_sane_LockN(lk);   4482   tmp___2 = vgHelgrind_is_sane_LockN(lk);
4483   if (tmp___2) {   4483   if (tmp___2) {
4484     4484  
4485   } else {   4485   } else {
4486     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4486     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4487                         (Char const   *)"hg_main.c", 330,   4487                         (Char const   *)"hg_main.c", 330,
4488                         (Char const   *)"lockN_release", "");   4488                         (Char const   *)"lockN_release", "");
4489   }   4489   }
4490   return;   4490   return;
4491 }   4491 }
4492 }   4492 }
4493 static void remove_Lock_from_locksets_of_all_owning_Threads(Lock *lk )   4493 static void remove_Lock_from_locksets_of_all_owning_Threads(Lock *lk )
4494 {   4494 {
4495   Thread *thr ;   4495   Thread *thr ;
4496   Bool tmp ;   4496   Bool tmp ;
4497   Bool tmp___0 ;   4497   Bool tmp___0 ;
4498   Bool tmp___1 ;   4498   Bool tmp___1 ;
4499   Bool tmp___2 ;   4499   Bool tmp___2 ;
4500     4500  
4501   {   4501   {
4502   if (! lk->heldBy) {   4502   if (! lk->heldBy) {
4503     if (! lk->heldW) {   4503     if (! lk->heldW) {
4504     4504  
4505     } else {   4505     } else {
4506       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   4506       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
4507                           (Char const   *)"hg_main.c", 337,   4507                           (Char const   *)"hg_main.c", 337,
4508                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4508                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4509                           "");   4509                           "");
4510     }   4510     }
4511     return;   4511     return;
4512   } else {   4512   } else {
4513     4513  
4514   }   4514   }
4515   vgPlain_initIterBag(lk->heldBy);   4515   vgPlain_initIterBag(lk->heldBy);
4516   while (1) {   4516   while (1) {
4517     tmp___2 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),   4517     tmp___2 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),
4518                                   (UWord *)((void *)0));   4518                                   (UWord *)((void *)0));
4519     if (tmp___2) {   4519     if (tmp___2) {
4520     4520  
4521     } else {   4521     } else {
4522       break;   4522       break;
4523     }   4523     }
4524     tmp = vgHelgrind_is_sane_Thread(thr);   4524     tmp = vgHelgrind_is_sane_Thread(thr);
4525     if (tmp) {   4525     if (tmp) {
4526     4526  
4527     } else {   4527     } else {
4528       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4528       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4529                           (Char const   *)"hg_main.c", 343,   4529                           (Char const   *)"hg_main.c", 343,
4530                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4530                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4531                           "");   4531                           "");
4532     }   4532     }
4533     tmp___0 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));   4533     tmp___0 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));
4534     if (tmp___0) {   4534     if (tmp___0) {
4535     4535  
4536     } else {   4536     } else {
4537       vgPlain_assert_fail((Bool )0,   4537       vgPlain_assert_fail((Bool )0,
4538                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lk )",   4538                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lk )",
4539                           (Char const   *)"hg_main.c", 345,   4539                           (Char const   *)"hg_main.c", 345,
4540                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4540                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4541                           "");   4541                           "");
4542     }   4542     }
4543     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,   4543     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,
4544                                          (UWord )((Word )lk));   4544                                          (UWord )((Word )lk));
4545     if (lk->heldW) {   4545     if (lk->heldW) {
4546       tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lk));   4546       tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lk));
4547       if (tmp___1) {   4547       if (tmp___1) {
4548     4548  
4549       } else {   4549       } else {
4550         vgPlain_assert_fail((Bool )0,   4550         vgPlain_assert_fail((Bool )0,
4551                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lk )",   4551                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lk )",
4552                             (Char const   *)"hg_main.c", 351,   4552                             (Char const   *)"hg_main.c", 351,
4553                             (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4553                             (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4554                             "");   4554                             "");
4555       }   4555       }
4556       thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,   4556       thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,
4557                                            (UWord )((Word )lk));   4557                                            (UWord )((Word )lk));
4558     } else {   4558     } else {
4559     4559  
4560     }   4560     }
4561   }   4561   }
4562   vgPlain_doneIterBag(lk->heldBy);   4562   vgPlain_doneIterBag(lk->heldBy);
4563   return;   4563   return;
4564 }   4564 }
4565 }   4565 }
4566 static int const   sHOW_ADMIN  =    (Int const   )0;   4566 static int const   sHOW_ADMIN  =    (Int const   )0;
4567 static void space(Int n )   4567 static void space(Int n )
4568 {   4568 {
4569   Int i ;   4569   Int i ;
4570   Char spaces[129] ;   4570   Char spaces[129] ;
4571     4571  
4572   {   4572   {
4573   if (n >= 0) {   4573   if (n >= 0) {
4574     if (n < 128) {   4574     if (n < 128) {
4575     4575  
4576     } else {   4576     } else {
4577       vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",   4577       vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",
4578                           (Char const   *)"hg_main.c", 375,   4578                           (Char const   *)"hg_main.c", 375,
4579                           (Char const   *)"space", "");   4579                           (Char const   *)"space", "");
4580     }   4580     }
4581   } else {   4581   } else {
4582     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",   4582     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",
4583                         (Char const   *)"hg_main.c", 375,   4583                         (Char const   *)"hg_main.c", 375,
4584                         (Char const   *)"space", "");   4584                         (Char const   *)"space", "");
4585   }   4585   }
4586   if (n == 0) {   4586   if (n == 0) {
4587     return;   4587     return;
4588   } else {   4588   } else {
4589     4589  
4590   }   4590   }
4591   i = 0;   4591   i = 0;
4592   while (i < n) {   4592   while (i < n) {
4593     spaces[i] = (Char )' ';   4593     spaces[i] = (Char )' ';
4594     i ++;   4594     i ++;
4595   }   4595   }
4596   spaces[i] = (Char )0;   4596   spaces[i] = (Char )0;
4597   if (i < 129) {   4597   if (i < 129) {
4598     4598  
4599   } else {   4599   } else {
4600     vgPlain_assert_fail((Bool )0, (Char const   *)"i < 128+1",   4600     vgPlain_assert_fail((Bool )0, (Char const   *)"i < 128+1",
4601                         (Char const   *)"hg_main.c", 381,   4601                         (Char const   *)"hg_main.c", 381,
4602                         (Char const   *)"space", "");   4602                         (Char const   *)"space", "");
4603   }   4603   }
4604   vgPlain_printf("%s", spaces);   4604   vgPlain_printf("%s", spaces);
4605   return;   4605   return;
4606 }   4606 }
4607 }   4607 }
4608 static void pp_Thread(Int d , Thread *t )   4608 static void pp_Thread(Int d , Thread *t )
4609 {   4609 {
4610     4610  
4611     4611  
4612   {   4612   {
4613   space(d);   4613   space(d);
4614   vgPlain_printf("Thread %p {\n", t);   4614   vgPlain_printf("Thread %p {\n", t);
4615   if (sHOW_ADMIN) {   4615   if (sHOW_ADMIN) {
4616     space(d + 3);   4616     space(d + 3);
4617     vgPlain_printf("admin    %p\n", t->admin);   4617     vgPlain_printf("admin    %p\n", t->admin);
4618     space(d + 3);   4618     space(d + 3);
4619     vgPlain_printf("magic    0x%x\n", t->magic);   4619     vgPlain_printf("magic    0x%x\n", t->magic);
4620   } else {   4620   } else {
4621     4621  
4622   }   4622   }
4623   space(d + 3);   4623   space(d + 3);
4624   vgPlain_printf("locksetA %d\n", (Int )t->locksetA);   4624   vgPlain_printf("locksetA %d\n", (Int )t->locksetA);
4625   space(d + 3);   4625   space(d + 3);
4626   vgPlain_printf("locksetW %d\n", (Int )t->locksetW);   4626   vgPlain_printf("locksetW %d\n", (Int )t->locksetW);
4627   space(d);   4627   space(d);
4628   vgPlain_printf("}\n");   4628   vgPlain_printf("}\n");
4629   return;   4629   return;
4630 }   4630 }
4631 }   4631 }
4632 static void pp_admin_threads(Int d )   4632 static void pp_admin_threads(Int d )
4633 {   4633 {
4634   Int i ;   4634   Int i ;
4635   Int n ;   4635   Int n ;
4636   Thread *t ;   4636   Thread *t ;
4637     4637  
4638   {   4638   {
4639   n = 0;   4639   n = 0;
4640   t = admin_threads;   4640   t = admin_threads;
4641   while (t) {   4641   while (t) {
4642     n ++;   4642     n ++;
4643     t = t->admin;   4643     t = t->admin;
4644   }   4644   }
4645   space(d);   4645   space(d);
4646   vgPlain_printf("admin_threads (%d records) {\n", n);   4646   vgPlain_printf("admin_threads (%d records) {\n", n);
4647   i = 0;   4647   i = 0;
4648   t = admin_threads;   4648   t = admin_threads;
4649   while (t) {   4649   while (t) {
4650     pp_Thread(d + 3, t);   4650     pp_Thread(d + 3, t);
4651     i ++;   4651     i ++;
4652     t = t->admin;   4652     t = t->admin;
4653   }   4653   }
4654   space(d);   4654   space(d);
4655   vgPlain_printf("}\n");   4655   vgPlain_printf("}\n");
4656   return;   4656   return;
4657 }   4657 }
4658 }   4658 }
4659 static void pp_map_threads(Int d )   4659 static void pp_map_threads(Int d )
4660 {   4660 {
4661   Int i ;   4661   Int i ;
4662   Int n ;   4662   Int n ;
4663     4663  
4664   {   4664   {
4665   n = 0;   4665   n = 0;
4666   space(d);   4666   space(d);
4667   vgPlain_printf("map_threads ");   4667   vgPlain_printf("map_threads ");
4668   i = 0;   4668   i = 0;
4669   while (i < 500) {   4669   while (i < 500) {
4670     if ((unsigned int )*(map_threads + i) != (unsigned int )((void *)0)) {   4670     if ((unsigned int )*(map_threads + i) != (unsigned int )((void *)0)) {
4671       n ++;   4671       n ++;
4672     } else {   4672     } else {
4673     4673  
4674     }   4674     }
4675     i ++;   4675     i ++;
4676   }   4676   }
4677   vgPlain_printf("(%d entries) {\n", n);   4677   vgPlain_printf("(%d entries) {\n", n);
4678   i = 0;   4678   i = 0;
4679   while (i < 500) {   4679   while (i < 500) {
4680     if ((unsigned int )*(map_threads + i) == (unsigned int )((void *)0)) {   4680     if ((unsigned int )*(map_threads + i) == (unsigned int )((void *)0)) {
4681       goto __Cont;   4681       goto __Cont;
4682     } else {   4682     } else {
4683     4683  
4684     }   4684     }
4685     space(d + 3);   4685     space(d + 3);
4686     vgPlain_printf("coretid %d -> Thread %p\n", i, *(map_threads + i));   4686     vgPlain_printf("coretid %d -> Thread %p\n", i, *(map_threads + i));
4687     __Cont: /* CIL Label */   4687     __Cont: /* CIL Label */
4688     i ++;   4688     i ++;
4689   }   4689   }
4690   space(d);   4690   space(d);
4691   vgPlain_printf("}\n");   4691   vgPlain_printf("}\n");
4692   return;   4692   return;
4693 }   4693 }
4694 }   4694 }
4695 static HChar const   *show_LockKind(LockKind lkk )   4695 static HChar const   *show_LockKind(LockKind lkk )
4696 {   4696 {
4697     4697  
4698     4698  
4699   {   4699   {
4700   switch ((unsigned int )lkk) {   4700   switch ((unsigned int )lkk) {
4701   case 1001U:   4701   case 1001U:
4702   return ("mbRec");   4702   return ("mbRec");
4703   case 1002U:   4703   case 1002U:
4704   return ("nonRec");   4704   return ("nonRec");
4705   case 1003U:   4705   case 1003U:
4706   return ("rdwr");   4706   return ("rdwr");
4707   default:   4707   default:
4708   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   4708   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
4709                       (Char const   *)"hg_main.c", 438,   4709                       (Char const   *)"hg_main.c", 438,
4710                       (Char const   *)"show_LockKind", "");   4710                       (Char const   *)"show_LockKind", "");
4711   }   4711   }
4712 }   4712 }
4713 }   4713 }
4714 static void pp_Lock(Int d , Lock *lk )   4714 static void pp_Lock(Int d , Lock *lk )
4715 {   4715 {
4716   HChar const   *tmp ;   4716   HChar const   *tmp ;
4717   char const   *tmp___0 ;   4717   char const   *tmp___0 ;
4718   Thread *thr ;   4718   Thread *thr ;
4719   Word count ;   4719   Word count ;
4720   Bool tmp___1 ;   4720   Bool tmp___1 ;
4721     4721  
4722   {   4722   {
4723   space(d);   4723   space(d);
4724   vgPlain_printf("Lock %p (ga %#lx) {\n", lk, lk->guestaddr);   4724   vgPlain_printf("Lock %p (ga %#lx) {\n", lk, lk->guestaddr);
4725   if (sHOW_ADMIN) {   4725   if (sHOW_ADMIN) {
4726     space(d + 3);   4726     space(d + 3);
4727     vgPlain_printf("admin_n  %p\n", lk->admin_next);   4727     vgPlain_printf("admin_n  %p\n", lk->admin_next);
4728     space(d + 3);   4728     space(d + 3);
4729     vgPlain_printf("admin_p  %p\n", lk->admin_prev);   4729     vgPlain_printf("admin_p  %p\n", lk->admin_prev);
4730     space(d + 3);   4730     space(d + 3);
4731     vgPlain_printf("magic    0x%x\n", lk->magic);   4731     vgPlain_printf("magic    0x%x\n", lk->magic);
4732   } else {   4732   } else {
4733     4733  
4734   }   4734   }
4735   space(d + 3);   4735   space(d + 3);
4736   vgPlain_printf("unique %llu\n", lk->unique);   4736   vgPlain_printf("unique %llu\n", lk->unique);
4737   space(d + 3);   4737   space(d + 3);
4738   tmp = show_LockKind(lk->kind);   4738   tmp = show_LockKind(lk->kind);
4739   vgPlain_printf("kind   %s\n", tmp);   4739   vgPlain_printf("kind   %s\n", tmp);
4740   space(d + 3);   4740   space(d + 3);
4741   if (lk->heldW) {   4741   if (lk->heldW) {
4742     tmp___0 = "yes";   4742     tmp___0 = "yes";
4743   } else {   4743   } else {
4744     tmp___0 = "no";   4744     tmp___0 = "no";
4745   }   4745   }
4746   vgPlain_printf("heldW  %s\n", tmp___0);   4746   vgPlain_printf("heldW  %s\n", tmp___0);
4747   space(d + 3);   4747   space(d + 3);
4748   vgPlain_printf("heldBy %p", lk->heldBy);   4748   vgPlain_printf("heldBy %p", lk->heldBy);
4749   if (lk->heldBy) {   4749   if (lk->heldBy) {
4750     vgPlain_printf(" { ");   4750     vgPlain_printf(" { ");
4751     vgPlain_initIterBag(lk->heldBy);   4751     vgPlain_initIterBag(lk->heldBy);
4752     while (1) {   4752     while (1) {
4753       tmp___1 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),   4753       tmp___1 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),
4754                                     (UWord *)(& count));   4754                                     (UWord *)(& count));
4755       if (tmp___1) {   4755       if (tmp___1) {
4756     4756  
4757       } else {   4757       } else {
4758         break;   4758         break;
4759       }   4759       }
4760       vgPlain_printf("%lu:%p ", count, thr);   4760       vgPlain_printf("%lu:%p ", count, thr);
4761     }   4761     }
4762     vgPlain_doneIterBag(lk->heldBy);   4762     vgPlain_doneIterBag(lk->heldBy);
4763     vgPlain_printf("}");   4763     vgPlain_printf("}");
4764   } else {   4764   } else {
4765     4765  
4766   }   4766   }
4767   vgPlain_printf("\n");   4767   vgPlain_printf("\n");
4768   space(d);   4768   space(d);
4769   vgPlain_printf("}\n");   4769   vgPlain_printf("}\n");
4770   return;   4770   return;
4771 }   4771 }
4772 }   4772 }
4773 static void pp_admin_locks(Int d )   4773 static void pp_admin_locks(Int d )
4774 {   4774 {
4775   Int i ;   4775   Int i ;
4776   Int n ;   4776   Int n ;
4777   Lock *lk ;   4777   Lock *lk ;
4778     4778  
4779   {   4779   {
4780   n = 0;   4780   n = 0;
4781   lk = admin_locks;   4781   lk = admin_locks;
4782   while (lk) {   4782   while (lk) {
4783     n ++;   4783     n ++;
4784     lk = lk->admin_next;   4784     lk = lk->admin_next;
4785   }   4785   }
4786   space(d);   4786   space(d);
4787   vgPlain_printf("admin_locks (%d records) {\n", n);   4787   vgPlain_printf("admin_locks (%d records) {\n", n);
4788   i = 0;   4788   i = 0;
4789   lk = admin_locks;   4789   lk = admin_locks;
4790   while (lk) {   4790   while (lk) {
4791     pp_Lock(d + 3, lk);   4791     pp_Lock(d + 3, lk);
4792     i ++;   4792     i ++;
4793     lk = lk->admin_next;   4793     lk = lk->admin_next;
4794   }   4794   }
4795   space(d);   4795   space(d);
4796   vgPlain_printf("}\n");   4796   vgPlain_printf("}\n");
4797   return;   4797   return;
4798 }   4798 }
4799 }   4799 }
4800 static void pp_map_locks(Int d )   4800 static void pp_map_locks(Int d )
4801 {   4801 {
4802   void *gla ;   4802   void *gla ;
4803   Lock *lk ;   4803   Lock *lk ;
4804   UWord tmp ;   4804   UWord tmp ;
4805   Bool tmp___0 ;   4805   Bool tmp___0 ;
4806     4806  
4807   {   4807   {
4808   space(d);   4808   space(d);
4809   tmp = vgPlain_sizeFM(map_locks);   4809   tmp = vgPlain_sizeFM(map_locks);
4810   vgPlain_printf("map_locks (%d entries) {\n", (Int )tmp);   4810   vgPlain_printf("map_locks (%d entries) {\n", (Int )tmp);
4811   vgPlain_initIterFM(map_locks);   4811   vgPlain_initIterFM(map_locks);
4812   while (1) {   4812   while (1) {
4813     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),   4813     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),
4814                                  (UWord *)((Word *)(& lk)));   4814                                  (UWord *)((Word *)(& lk)));
4815     if (tmp___0) {   4815     if (tmp___0) {
4816     4816  
4817     } else {   4817     } else {
4818       break;   4818       break;
4819     }   4819     }
4820     space(d + 3);   4820     space(d + 3);
4821     vgPlain_printf("guest %p -> Lock %p\n", gla, lk);   4821     vgPlain_printf("guest %p -> Lock %p\n", gla, lk);
4822   }   4822   }
4823   vgPlain_doneIterFM(map_locks);   4823   vgPlain_doneIterFM(map_locks);
4824   space(d);   4824   space(d);
4825   vgPlain_printf("}\n");   4825   vgPlain_printf("}\n");
4826   return;   4826   return;
4827 }   4827 }
4828 }   4828 }
4829 static void pp_everything(Int flags , Char *caller )   4829 static void pp_everything(Int flags , Char *caller )
4830 {   4830 {
4831   Int d ;   4831   Int d ;
4832     4832  
4833   {   4833   {
4834   d = 0;   4834   d = 0;
4835   vgPlain_printf("\n");   4835   vgPlain_printf("\n");
4836   vgPlain_printf("All_Data_Structures (caller = \"%s\") {\n", caller);   4836   vgPlain_printf("All_Data_Structures (caller = \"%s\") {\n", caller);
4837   if (flags & (1 << 1)) {   4837   if (flags & (1 << 1)) {
4838     vgPlain_printf("\n");   4838     vgPlain_printf("\n");
4839     pp_admin_threads(d + 3);   4839     pp_admin_threads(d + 3);
4840     vgPlain_printf("\n");   4840     vgPlain_printf("\n");
4841     pp_map_threads(d + 3);   4841     pp_map_threads(d + 3);
4842   } else {   4842   } else {
4843     4843  
4844   }   4844   }
4845   if (flags & (1 << 2)) {   4845   if (flags & (1 << 2)) {
4846     vgPlain_printf("\n");   4846     vgPlain_printf("\n");
4847     pp_admin_locks(d + 3);   4847     pp_admin_locks(d + 3);
4848     vgPlain_printf("\n");   4848     vgPlain_printf("\n");
4849     pp_map_locks(d + 3);   4849     pp_map_locks(d + 3);
4850   } else {   4850   } else {
4851     4851  
4852   }   4852   }
4853   vgPlain_printf("\n");   4853   vgPlain_printf("\n");
4854   vgPlain_printf("}\n");   4854   vgPlain_printf("}\n");
4855   vgPlain_printf("\n");   4855   vgPlain_printf("\n");
4856   return;   4856   return;
4857 }   4857 }
4858 }   4858 }
4859 static void initialise_data_structures(Thr *hbthr_root )   4859 static void initialise_data_structures(Thr *hbthr_root )
4860 {   4860 {
4861   Thread *thr ;   4861   Thread *thr ;
4862   void *tmp ;   4862   void *tmp ;
4863   void *tmp___0 ;   4863   void *tmp___0 ;
4864   Bool tmp___1 ;   4864   Bool tmp___1 ;
4865     4865  
4866   {   4866   {
4867   if ((unsigned int )admin_threads == (unsigned int )((void *)0)) {   4867   if ((unsigned int )admin_threads == (unsigned int )((void *)0)) {
4868     4868  
4869   } else {   4869   } else {
4870     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_threads == NULL",   4870     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_threads == NULL",
4871                         (Char const   *)"hg_main.c", 537,   4871                         (Char const   *)"hg_main.c", 537,
4872                         (Char const   *)"initialise_data_structures", "");   4872                         (Char const   *)"initialise_data_structures", "");
4873   }   4873   }
4874   if ((unsigned int )admin_locks == (unsigned int )((void *)0)) {   4874   if ((unsigned int )admin_locks == (unsigned int )((void *)0)) {
4875     4875  
4876   } else {   4876   } else {
4877     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_locks == NULL",   4877     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_locks == NULL",
4878                         (Char const   *)"hg_main.c", 538,   4878                         (Char const   *)"hg_main.c", 538,
4879                         (Char const   *)"initialise_data_structures", "");   4879                         (Char const   *)"initialise_data_structures", "");
4880   }   4880   }
4881   if (sizeof(Addr ) == sizeof(Word )) {   4881   if (sizeof(Addr ) == sizeof(Word )) {
4882     4882  
4883   } else {   4883   } else {
4884     vgPlain_assert_fail((Bool )0,   4884     vgPlain_assert_fail((Bool )0,
4885                         (Char const   *)"sizeof(Addr) == sizeof(Word)",   4885                         (Char const   *)"sizeof(Addr) == sizeof(Word)",
4886                         (Char const   *)"hg_main.c", 540,   4886                         (Char const   *)"hg_main.c", 540,
4887                         (Char const   *)"initialise_data_structures", "");   4887                         (Char const   *)"initialise_data_structures", "");
4888   }   4888   }
4889   if ((unsigned int )map_threads == (unsigned int )((void *)0)) {   4889   if ((unsigned int )map_threads == (unsigned int )((void *)0)) {
4890     4890  
4891   } else {   4891   } else {
4892     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads == NULL",   4892     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads == NULL",
4893                         (Char const   *)"hg_main.c", 542,   4893                         (Char const   *)"hg_main.c", 542,
4894                         (Char const   *)"initialise_data_structures", "");   4894                         (Char const   *)"initialise_data_structures", "");
4895   }   4895   }
4896   tmp = vgHelgrind_zalloc((HChar *)"hg.ids.1", (SizeT )(500U * sizeof(Thread *)));   4896   tmp = vgHelgrind_zalloc((HChar *)"hg.ids.1", (SizeT )(500U * sizeof(Thread *)));
4897   map_threads = (Thread **)tmp;   4897   map_threads = (Thread **)tmp;
4898   if ((unsigned int )map_threads != (unsigned int )((void *)0)) {   4898   if ((unsigned int )map_threads != (unsigned int )((void *)0)) {
4899     4899  
4900   } else {   4900   } else {
4901     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads != NULL",   4901     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads != NULL",
4902                         (Char const   *)"hg_main.c", 544,   4902                         (Char const   *)"hg_main.c", 544,
4903                         (Char const   *)"initialise_data_structures", "");   4903                         (Char const   *)"initialise_data_structures", "");
4904   }   4904   }
4905   if (sizeof(Addr ) == sizeof(Word )) {   4905   if (sizeof(Addr ) == sizeof(Word )) {
4906     4906  
4907   } else {   4907   } else {
4908     vgPlain_assert_fail((Bool )0,   4908     vgPlain_assert_fail((Bool )0,
4909                         (Char const   *)"sizeof(Addr) == sizeof(Word)",   4909                         (Char const   *)"sizeof(Addr) == sizeof(Word)",
4910                         (Char const   *)"hg_main.c", 546,   4910                         (Char const   *)"hg_main.c", 546,
4911                         (Char const   *)"initialise_data_structures", "");   4911                         (Char const   *)"initialise_data_structures", "");
4912   }   4912   }
4913   if ((unsigned int )map_locks == (unsigned int )((void *)0)) {   4913   if ((unsigned int )map_locks == (unsigned int )((void *)0)) {
4914     4914  
4915   } else {   4915   } else {
4916     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks == NULL",   4916     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks == NULL",
4917                         (Char const   *)"hg_main.c", 547,   4917                         (Char const   *)"hg_main.c", 547,
4918                         (Char const   *)"initialise_data_structures", "");   4918                         (Char const   *)"initialise_data_structures", "");
4919   }   4919   }
4920   map_locks = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.ids.2",   4920   map_locks = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.ids.2",
4921                             & vgHelgrind_free,   4921                             & vgHelgrind_free,
4922                             (Word (*)(UWord  , UWord  ))((void *)0));   4922                             (Word (*)(UWord  , UWord  ))((void *)0));
4923   if ((unsigned int )map_locks != (unsigned int )((void *)0)) {   4923   if ((unsigned int )map_locks != (unsigned int )((void *)0)) {
4924     4924  
4925   } else {   4925   } else {
4926     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks != NULL",   4926     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks != NULL",
4927                         (Char const   *)"hg_main.c", 550,   4927                         (Char const   *)"hg_main.c", 550,
4928                         (Char const   *)"initialise_data_structures", "");   4928                         (Char const   *)"initialise_data_structures", "");
4929   }   4929   }
4930   if ((unsigned int )univ_tsets == (unsigned int )((void *)0)) {   4930   if ((unsigned int )univ_tsets == (unsigned int )((void *)0)) {
4931     4931  
4932   } else {   4932   } else {
4933     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_tsets == NULL",   4933     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_tsets == NULL",
4934                         (Char const   *)"hg_main.c", 552,   4934                         (Char const   *)"hg_main.c", 552,
4935                         (Char const   *)"initialise_data_structures", "");   4935                         (Char const   *)"initialise_data_structures", "");
4936   }   4936   }
4937   univ_tsets = vgHelgrind_newWordSetU(& vgHelgrind_zalloc, (HChar *)"hg.ids.3",   4937   univ_tsets = vgHelgrind_newWordSetU(& vgHelgrind_zalloc, (HChar *)"hg.ids.3",
4938                                       & vgHelgrind_free, (Word )8);   4938                                       & vgHelgrind_free, (Word )8);
4939   if ((unsigned int )univ_tsets != (unsigned int )((void *)0)) {   4939   if ((unsigned int )univ_tsets != (unsigned int )((void *)0)) {
4940     4940  
4941   } else {   4941   } else {
4942     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_tsets != NULL",   4942     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_tsets != NULL",
4943                         (Char const   *)"hg_main.c", 555,   4943                         (Char const   *)"hg_main.c", 555,
4944                         (Char const   *)"initialise_data_structures", "");   4944                         (Char const   *)"initialise_data_structures", "");
4945   }   4945   }
4946   if ((unsigned int )univ_lsets == (unsigned int )((void *)0)) {   4946   if ((unsigned int )univ_lsets == (unsigned int )((void *)0)) {
4947     4947  
4948   } else {   4948   } else {
4949     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets == NULL",   4949     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets == NULL",
4950                         (Char const   *)"hg_main.c", 557,   4950                         (Char const   *)"hg_main.c", 557,
4951                         (Char const   *)"initialise_data_structures", "");   4951                         (Char const   *)"initialise_data_structures", "");
4952   }   4952   }
4953   univ_lsets = vgHelgrind_newWordSetU(& vgHelgrind_zalloc, (HChar *)"hg.ids.4",   4953   univ_lsets = vgHelgrind_newWordSetU(& vgHelgrind_zalloc, (HChar *)"hg.ids.4",
4954                                       & vgHelgrind_free, (Word )8);   4954                                       & vgHelgrind_free, (Word )8);
4955   if ((unsigned int )univ_lsets != (unsigned int )((void *)0)) {   4955   if ((unsigned int )univ_lsets != (unsigned int )((void *)0)) {
4956     4956  
4957   } else {   4957   } else {
4958     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets != NULL",   4958     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets != NULL",
4959                         (Char const   *)"hg_main.c", 560,   4959                         (Char const   *)"hg_main.c", 560,
4960                         (Char const   *)"initialise_data_structures", "");   4960                         (Char const   *)"initialise_data_structures", "");
4961   }   4961   }
4962   if ((unsigned int )univ_laog == (unsigned int )((void *)0)) {   4962   if ((unsigned int )univ_laog == (unsigned int )((void *)0)) {
4963     4963  
4964   } else {   4964   } else {
4965     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog == NULL",   4965     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog == NULL",
4966                         (Char const   *)"hg_main.c", 562,   4966                         (Char const   *)"hg_main.c", 562,
4967                         (Char const   *)"initialise_data_structures", "");   4967                         (Char const   *)"initialise_data_structures", "");
4968   }   4968   }
4969   if (vgHelgrind_clo_track_lockorders) {   4969   if (vgHelgrind_clo_track_lockorders) {
4970     univ_laog = vgHelgrind_newWordSetU(& vgHelgrind_zalloc,   4970     univ_laog = vgHelgrind_newWordSetU(& vgHelgrind_zalloc,
4971                                        (HChar *)"hg.ids.5 (univ_laog)",   4971                                        (HChar *)"hg.ids.5 (univ_laog)",
4972                                        & vgHelgrind_free, (Word )24);   4972                                        & vgHelgrind_free, (Word )24);
4973     if ((unsigned int )univ_laog != (unsigned int )((void *)0)) {   4973     if ((unsigned int )univ_laog != (unsigned int )((void *)0)) {
4974     4974  
4975     } else {   4975     } else {
4976       vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog != NULL",   4976       vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog != NULL",
4977                           (Char const   *)"hg_main.c", 566,   4977                           (Char const   *)"hg_main.c", 566,
4978                           (Char const   *)"initialise_data_structures", "");   4978                           (Char const   *)"initialise_data_structures", "");
4979     }   4979     }
4980   } else {   4980   } else {
4981     4981  
4982   }   4982   }
4983   thr = mk_Thread(hbthr_root);   4983   thr = mk_Thread(hbthr_root);
4984   thr->coretid = (ThreadId )1;   4984   thr->coretid = (ThreadId )1;
4985   tmp___0 = libhb_get_Thr_hgthread(hbthr_root);   4985   tmp___0 = libhb_get_Thr_hgthread(hbthr_root);
4986   if ((unsigned int )tmp___0 == (unsigned int )((void *)0)) {   4986   if ((unsigned int )tmp___0 == (unsigned int )((void *)0)) {
4987     4987  
4988   } else {   4988   } else {
4989     vgPlain_assert_fail((Bool )0,   4989     vgPlain_assert_fail((Bool )0,
4990                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_root) == NULL",   4990                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_root) == NULL",
4991                         (Char const   *)"hg_main.c", 576,   4991                         (Char const   *)"hg_main.c", 576,
4992                         (Char const   *)"initialise_data_structures", "");   4992                         (Char const   *)"initialise_data_structures", "");
4993   }   4993   }
4994   libhb_set_Thr_hgthread(hbthr_root, (void *)thr);   4994   libhb_set_Thr_hgthread(hbthr_root, (void *)thr);
4995   tmp___1 = vgHelgrind_is_sane_ThreadId(thr->coretid);   4995   tmp___1 = vgHelgrind_is_sane_ThreadId(thr->coretid);
4996   if (tmp___1) {   4996   if (tmp___1) {
4997     4997  
4998   } else {   4998   } else {
4999     vgPlain_assert_fail((Bool )0,   4999     vgPlain_assert_fail((Bool )0,
5000                         (Char const   *)"HG_(is_sane_ThreadId)(thr->coretid)",   5000                         (Char const   *)"HG_(is_sane_ThreadId)(thr->coretid)",
5001                         (Char const   *)"hg_main.c", 580,   5001                         (Char const   *)"hg_main.c", 580,
5002                         (Char const   *)"initialise_data_structures", "");   5002                         (Char const   *)"initialise_data_structures", "");
5003   }   5003   }
5004   if (thr->coretid != 0U) {   5004   if (thr->coretid != 0U) {
5005     5005  
5006   } else {   5006   } else {
5007     vgPlain_assert_fail((Bool )0,   5007     vgPlain_assert_fail((Bool )0,
5008                         (Char const   *)"thr->coretid != VG_INVALID_THREADID",   5008                         (Char const   *)"thr->coretid != VG_INVALID_THREADID",
5009                         (Char const   *)"hg_main.c", 581,   5009                         (Char const   *)"hg_main.c", 581,
5010                         (Char const   *)"initialise_data_structures", "");   5010                         (Char const   *)"initialise_data_structures", "");
5011   }   5011   }
5012   *(map_threads + thr->coretid) = thr;   5012   *(map_threads + thr->coretid) = thr;
5013   all__sanity_check((Char *)"initialise_data_structures");   5013   all__sanity_check((Char *)"initialise_data_structures");
5014   return;   5014   return;
5015 }   5015 }
5016 }   5016 }
5017 static Thread *map_threads_maybe_lookup(ThreadId coretid )   5017 static Thread *map_threads_maybe_lookup(ThreadId coretid )
5018 {   5018 {
5019   Thread *thr ;   5019   Thread *thr ;
5020   Bool tmp ;   5020   Bool tmp ;
5021     5021  
5022   {   5022   {
5023   tmp = vgHelgrind_is_sane_ThreadId(coretid);   5023   tmp = vgHelgrind_is_sane_ThreadId(coretid);
5024   if (tmp) {   5024   if (tmp) {
5025     5025  
5026   } else {   5026   } else {
5027     vgPlain_assert_fail((Bool )0,   5027     vgPlain_assert_fail((Bool )0,
5028                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",   5028                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",
5029                         (Char const   *)"hg_main.c", 599,   5029                         (Char const   *)"hg_main.c", 599,
5030                         (Char const   *)"map_threads_maybe_lookup", "");   5030                         (Char const   *)"map_threads_maybe_lookup", "");
5031   }   5031   }
5032   thr = *(map_threads + coretid);   5032   thr = *(map_threads + coretid);
5033   return (thr);   5033   return (thr);
5034 }   5034 }
5035 }   5035 }
5036 __inline static Thread *map_threads_lookup(ThreadId coretid )   5036 __inline static Thread *map_threads_lookup(ThreadId coretid )
5037 {   5037 {
5038   Thread *thr ;   5038   Thread *thr ;
5039   Bool tmp ;   5039   Bool tmp ;
5040     5040  
5041   {   5041   {
5042   tmp = vgHelgrind_is_sane_ThreadId(coretid);   5042   tmp = vgHelgrind_is_sane_ThreadId(coretid);
5043   if (tmp) {   5043   if (tmp) {
5044     5044  
5045   } else {   5045   } else {
5046     vgPlain_assert_fail((Bool )0,   5046     vgPlain_assert_fail((Bool )0,
5047                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",   5047                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",
5048                         (Char const   *)"hg_main.c", 608,   5048                         (Char const   *)"hg_main.c", 608,
5049                         (Char const   *)"map_threads_lookup", "");   5049                         (Char const   *)"map_threads_lookup", "");
5050   }   5050   }
5051   thr = *(map_threads + coretid);   5051   thr = *(map_threads + coretid);
5052   if (thr) {   5052   if (thr) {
5053     5053  
5054   } else {   5054   } else {
5055     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   5055     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
5056                         (Char const   *)"hg_main.c", 610,   5056                         (Char const   *)"hg_main.c", 610,
5057                         (Char const   *)"map_threads_lookup", "");   5057                         (Char const   *)"map_threads_lookup", "");
5058   }   5058   }
5059   return (thr);   5059   return (thr);
5060 }   5060 }
5061 }   5061 }
5062 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr )   5062 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr )
5063 {   5063 {
5064   ThreadId tid ;   5064   ThreadId tid ;
5065   Bool tmp ;   5065   Bool tmp ;
5066   Bool tmp___0 ;   5066   Bool tmp___0 ;
5067     5067  
5068   {   5068   {
5069   tmp = vgHelgrind_is_sane_Thread(thr);   5069   tmp = vgHelgrind_is_sane_Thread(thr);
5070   if (tmp) {   5070   if (tmp) {
5071     5071  
5072   } else {   5072   } else {
5073     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5073     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5074                         (Char const   *)"hg_main.c", 619,   5074                         (Char const   *)"hg_main.c", 619,
5075                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",   5075                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",
5076                         "");   5076                         "");
5077   }   5077   }
5078   if ((unsigned int )*(map_threads + 0U) == (unsigned int )((void *)0)) {   5078   if ((unsigned int )*(map_threads + 0U) == (unsigned int )((void *)0)) {
5079     5079  
5080   } else {   5080   } else {
5081     vgPlain_assert_fail((Bool )0,   5081     vgPlain_assert_fail((Bool )0,
5082                         (Char const   *)"map_threads[VG_INVALID_THREADID] == NULL",   5082                         (Char const   *)"map_threads[VG_INVALID_THREADID] == NULL",
5083                         (Char const   *)"hg_main.c", 622,   5083                         (Char const   *)"hg_main.c", 622,
5084                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",   5084                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",
5085                         "");   5085                         "");
5086   }   5086   }
5087   tid = thr->coretid;   5087   tid = thr->coretid;
5088   tmp___0 = vgHelgrind_is_sane_ThreadId(tid);   5088   tmp___0 = vgHelgrind_is_sane_ThreadId(tid);
5089   if (tmp___0) {   5089   if (tmp___0) {
5090     5090  
5091   } else {   5091   } else {
5092     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",   5092     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",
5093                         (Char const   *)"hg_main.c", 624,   5093                         (Char const   *)"hg_main.c", 624,
5094                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",   5094                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",
5095                         "");   5095                         "");
5096   }   5096   }
5097   return (tid);   5097   return (tid);
5098 }   5098 }
5099 }   5099 }
5100 static ThreadId map_threads_reverse_lookup_SLOW(Thread *thr )   5100 static ThreadId map_threads_reverse_lookup_SLOW(Thread *thr )
5101 {   5101 {
5102   ThreadId tid ;   5102   ThreadId tid ;
5103   ThreadId tmp ;   5103   ThreadId tmp ;
5104     5104  
5105   {   5105   {
5106   tmp = map_threads_maybe_reverse_lookup_SLOW(thr);   5106   tmp = map_threads_maybe_reverse_lookup_SLOW(thr);
5107   tid = tmp;   5107   tid = tmp;
5108   if (tid != 0U) {   5108   if (tid != 0U) {
5109     5109  
5110   } else {   5110   } else {
5111     vgPlain_assert_fail((Bool )0, (Char const   *)"tid != VG_INVALID_THREADID",   5111     vgPlain_assert_fail((Bool )0, (Char const   *)"tid != VG_INVALID_THREADID",
5112                         (Char const   *)"hg_main.c", 633,   5112                         (Char const   *)"hg_main.c", 633,
5113                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");   5113                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");
5114   }   5114   }
5115   if (*(map_threads + tid)) {   5115   if (*(map_threads + tid)) {
5116     5116  
5117   } else {   5117   } else {
5118     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads[tid]",   5118     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads[tid]",
5119                         (Char const   *)"hg_main.c", 634,   5119                         (Char const   *)"hg_main.c", 634,
5120                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");   5120                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");
5121   }   5121   }
5122   if ((*(map_threads + tid))->coretid == tid) {   5122   if ((*(map_threads + tid))->coretid == tid) {
5123     5123  
5124   } else {   5124   } else {
5125     vgPlain_assert_fail((Bool )0,   5125     vgPlain_assert_fail((Bool )0,
5126                         (Char const   *)"map_threads[tid]->coretid == tid",   5126                         (Char const   *)"map_threads[tid]->coretid == tid",
5127                         (Char const   *)"hg_main.c", 635,   5127                         (Char const   *)"hg_main.c", 635,
5128                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");   5128                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");
5129   }   5129   }
5130   return (tid);   5130   return (tid);
5131 }   5131 }
5132 }   5132 }
5133 static void map_threads_delete(ThreadId coretid )   5133 static void map_threads_delete(ThreadId coretid )
5134 {   5134 {
5135   Thread *thr ;   5135   Thread *thr ;
5136   Bool tmp ;   5136   Bool tmp ;
5137     5137  
5138   {   5138   {
5139   if (coretid != 0U) {   5139   if (coretid != 0U) {
5140     5140  
5141   } else {   5141   } else {
5142     vgPlain_assert_fail((Bool )0, (Char const   *)"coretid != 0",   5142     vgPlain_assert_fail((Bool )0, (Char const   *)"coretid != 0",
5143                         (Char const   *)"hg_main.c", 642,   5143                         (Char const   *)"hg_main.c", 642,
5144                         (Char const   *)"map_threads_delete", "");   5144                         (Char const   *)"map_threads_delete", "");
5145   }   5145   }
5146   tmp = vgHelgrind_is_sane_ThreadId(coretid);   5146   tmp = vgHelgrind_is_sane_ThreadId(coretid);
5147   if (tmp) {   5147   if (tmp) {
5148     5148  
5149   } else {   5149   } else {
5150     vgPlain_assert_fail((Bool )0,   5150     vgPlain_assert_fail((Bool )0,
5151                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",   5151                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",
5152                         (Char const   *)"hg_main.c", 643,   5152                         (Char const   *)"hg_main.c", 643,
5153                         (Char const   *)"map_threads_delete", "");   5153                         (Char const   *)"map_threads_delete", "");
5154   }   5154   }
5155   thr = *(map_threads + coretid);   5155   thr = *(map_threads + coretid);
5156   if (thr) {   5156   if (thr) {
5157     5157  
5158   } else {   5158   } else {
5159     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   5159     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
5160                         (Char const   *)"hg_main.c", 645,   5160                         (Char const   *)"hg_main.c", 645,
5161                         (Char const   *)"map_threads_delete", "");   5161                         (Char const   *)"map_threads_delete", "");
5162   }   5162   }
5163   *(map_threads + coretid) = (Thread *)((void *)0);   5163   *(map_threads + coretid) = (Thread *)((void *)0);
5164   return;   5164   return;
5165 }   5165 }
5166 }   5166 }
5167 static Lock *map_locks_lookup_or_create(LockKind lkk , Addr ga , ThreadId tid )   5167 static Lock *map_locks_lookup_or_create(LockKind lkk , Addr ga , ThreadId tid )
5168 {   5168 {
5169   Bool found ;   5169   Bool found ;
5170   Lock *oldlock ;   5170   Lock *oldlock ;
5171   Bool tmp ;   5171   Bool tmp ;
5172   Lock *lock ;   5172   Lock *lock ;
5173   Lock *tmp___0 ;   5173   Lock *tmp___0 ;
5174   Bool tmp___1 ;   5174   Bool tmp___1 ;
5175   Bool tmp___2 ;   5175   Bool tmp___2 ;
5176     5176  
5177   {   5177   {
5178   oldlock = (Lock *)((void *)0);   5178   oldlock = (Lock *)((void *)0);
5179   tmp = vgHelgrind_is_sane_ThreadId(tid);   5179   tmp = vgHelgrind_is_sane_ThreadId(tid);
5180   if (tmp) {   5180   if (tmp) {
5181     5181  
5182   } else {   5182   } else {
5183     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",   5183     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",
5184                         (Char const   *)"hg_main.c", 662,   5184                         (Char const   *)"hg_main.c", 662,
5185                         (Char const   *)"map_locks_lookup_or_create", "");   5185                         (Char const   *)"map_locks_lookup_or_create", "");
5186   }   5186   }
5187   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),   5187   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),
5188                            (UWord *)((Word *)(& oldlock)), (UWord )((Word )ga));   5188                            (UWord *)((Word *)(& oldlock)), (UWord )((Word )ga));
5189   if (! found) {   5189   if (! found) {
5190     tmp___0 = mk_LockN(lkk, ga);   5190     tmp___0 = mk_LockN(lkk, ga);
5191     lock = tmp___0;   5191     lock = tmp___0;
5192     lock->appeared_at = vgPlain_record_ExeContext(tid, (Word )0);   5192     lock->appeared_at = vgPlain_record_ExeContext(tid, (Word )0);
5193     tmp___1 = vgHelgrind_is_sane_LockN(lock);   5193     tmp___1 = vgHelgrind_is_sane_LockN(lock);
5194     if (tmp___1) {   5194     if (tmp___1) {
5195     5195  
5196     } else {   5196     } else {
5197       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   5197       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
5198                           (Char const   *)"hg_main.c", 668,   5198                           (Char const   *)"hg_main.c", 668,
5199                           (Char const   *)"map_locks_lookup_or_create", "");   5199                           (Char const   *)"map_locks_lookup_or_create", "");
5200     }   5200     }
5201     vgPlain_addToFM(map_locks, (UWord )((Word )ga), (UWord )((Word )lock));   5201     vgPlain_addToFM(map_locks, (UWord )((Word )ga), (UWord )((Word )lock));
5202     if ((unsigned int )oldlock == (unsigned int )((void *)0)) {   5202     if ((unsigned int )oldlock == (unsigned int )((void *)0)) {
5203     5203  
5204     } else {   5204     } else {
5205       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock == NULL",   5205       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock == NULL",
5206                           (Char const   *)"hg_main.c", 670,   5206                           (Char const   *)"hg_main.c", 670,
5207                           (Char const   *)"map_locks_lookup_or_create", "");   5207                           (Char const   *)"map_locks_lookup_or_create", "");
5208     }   5208     }
5209     return (lock);   5209     return (lock);
5210   } else {   5210   } else {
5211     if ((unsigned int )oldlock != (unsigned int )((void *)0)) {   5211     if ((unsigned int )oldlock != (unsigned int )((void *)0)) {
5212     5212  
5213     } else {   5213     } else {
5214       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock != NULL",   5214       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock != NULL",
5215                           (Char const   *)"hg_main.c", 673,   5215                           (Char const   *)"hg_main.c", 673,
5216                           (Char const   *)"map_locks_lookup_or_create", "");   5216                           (Char const   *)"map_locks_lookup_or_create", "");
5217     }   5217     }
5218     tmp___2 = vgHelgrind_is_sane_LockN(oldlock);   5218     tmp___2 = vgHelgrind_is_sane_LockN(oldlock);
5219     if (tmp___2) {   5219     if (tmp___2) {
5220     5220  
5221     } else {   5221     } else {
5222       vgPlain_assert_fail((Bool )0,   5222       vgPlain_assert_fail((Bool )0,
5223                           (Char const   *)"HG_(is_sane_LockN)(oldlock)",   5223                           (Char const   *)"HG_(is_sane_LockN)(oldlock)",
5224                           (Char const   *)"hg_main.c", 674,   5224                           (Char const   *)"hg_main.c", 674,
5225                           (Char const   *)"map_locks_lookup_or_create", "");   5225                           (Char const   *)"map_locks_lookup_or_create", "");
5226     }   5226     }
5227     if (oldlock->guestaddr == ga) {   5227     if (oldlock->guestaddr == ga) {
5228     5228  
5229     } else {   5229     } else {
5230       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock->guestaddr == ga",   5230       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock->guestaddr == ga",
5231                           (Char const   *)"hg_main.c", 675,   5231                           (Char const   *)"hg_main.c", 675,
5232                           (Char const   *)"map_locks_lookup_or_create", "");   5232                           (Char const   *)"map_locks_lookup_or_create", "");
5233     }   5233     }
5234     return (oldlock);   5234     return (oldlock);
5235   }   5235   }
5236 }   5236 }
5237 }   5237 }
5238 static Lock *map_locks_maybe_lookup(Addr ga )   5238 static Lock *map_locks_maybe_lookup(Addr ga )
5239 {   5239 {
5240   Bool found ;   5240   Bool found ;
5241   Lock *lk ;   5241   Lock *lk ;
5242   int tmp ;   5242   int tmp ;
5243     5243  
5244   {   5244   {
5245   lk = (Lock *)((void *)0);   5245   lk = (Lock *)((void *)0);
5246   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),   5246   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),
5247                            (UWord *)((Word *)(& lk)), (UWord )((Word )ga));   5247                            (UWord *)((Word *)(& lk)), (UWord )((Word )ga));
5248   if (found) {   5248   if (found) {
5249     tmp = (unsigned int )lk != (unsigned int )((void *)0);   5249     tmp = (unsigned int )lk != (unsigned int )((void *)0);
5250   } else {   5250   } else {
5251     tmp = (unsigned int )lk == (unsigned int )((void *)0);   5251     tmp = (unsigned int )lk == (unsigned int )((void *)0);
5252   }   5252   }
5253   if (tmp) {   5253   if (tmp) {
5254     5254  
5255   } else {   5255   } else {
5256     vgPlain_assert_fail((Bool )0,   5256     vgPlain_assert_fail((Bool )0,
5257                         (Char const   *)"found ? lk != NULL : lk == NULL",   5257                         (Char const   *)"found ? lk != NULL : lk == NULL",
5258                         (Char const   *)"hg_main.c", 685,   5258                         (Char const   *)"hg_main.c", 685,
5259                         (Char const   *)"map_locks_maybe_lookup", "");   5259                         (Char const   *)"map_locks_maybe_lookup", "");
5260   }   5260   }
5261   return (lk);   5261   return (lk);
5262 }   5262 }
5263 }   5263 }
5264 static void map_locks_delete(Addr ga )   5264 static void map_locks_delete(Addr ga )
5265 {   5265 {
5266   Addr ga2 ;   5266   Addr ga2 ;
5267   Lock *lk ;   5267   Lock *lk ;
5268     5268  
5269   {   5269   {
5270   ga2 = (Addr )0;   5270   ga2 = (Addr )0;
5271   lk = (Lock *)((void *)0);   5271   lk = (Lock *)((void *)0);
5272   vgPlain_delFromFM(map_locks, (UWord *)((Word *)(& ga2)),   5272   vgPlain_delFromFM(map_locks, (UWord *)((Word *)(& ga2)),
5273                     (UWord *)((Word *)(& lk)), (UWord )((Word )ga));   5273                     (UWord *)((Word *)(& lk)), (UWord )((Word )ga));
5274   if ((unsigned int )lk != (unsigned int )((void *)0)) {   5274   if ((unsigned int )lk != (unsigned int )((void *)0)) {
5275     5275  
5276   } else {   5276   } else {
5277     vgPlain_assert_fail((Bool )0, (Char const   *)"lk != NULL",   5277     vgPlain_assert_fail((Bool )0, (Char const   *)"lk != NULL",
5278                         (Char const   *)"hg_main.c", 698,   5278                         (Char const   *)"hg_main.c", 698,
5279                         (Char const   *)"map_locks_delete", "");   5279                         (Char const   *)"map_locks_delete", "");
5280   }   5280   }
5281   if (ga2 == ga) {   5281   if (ga2 == ga) {
5282     5282  
5283   } else {   5283   } else {
5284     vgPlain_assert_fail((Bool )0, (Char const   *)"ga2 == ga",   5284     vgPlain_assert_fail((Bool )0, (Char const   *)"ga2 == ga",
5285                         (Char const   *)"hg_main.c", 699,   5285                         (Char const   *)"hg_main.c", 699,
5286                         (Char const   *)"map_locks_delete", "");   5286                         (Char const   *)"map_locks_delete", "");
5287   }   5287   }
5288   return;   5288   return;
5289 }   5289 }
5290 }   5290 }
5291 static UWord stats__sanity_checks  =    (UWord )0;   5291 static UWord stats__sanity_checks  =    (UWord )0;
5292 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who ) ;   5292 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who ) ;
5293 static Bool thread_is_a_holder_of_Lock(Thread *thr , Lock *lk )   5293 static Bool thread_is_a_holder_of_Lock(Thread *thr , Lock *lk )
5294 {   5294 {
5295   UWord tmp ;   5295   UWord tmp ;
5296     5296  
5297   {   5297   {
5298   if (lk->heldBy) {   5298   if (lk->heldBy) {
5299     tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   5299     tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
5300     return ((Bool )(tmp > 0UL));   5300     return ((Bool )(tmp > 0UL));
5301   } else {   5301   } else {
5302     return ((Bool )0);   5302     return ((Bool )0);
5303   }   5303   }
5304 }   5304 }
5305 }   5305 }
5306 static void ( __attribute__((__noinline__)) threads__sanity_check)(Char *who )   5306 static void ( __attribute__((__noinline__)) threads__sanity_check)(Char *who )
5307 {   5307 {
5308   Char *how ;   5308   Char *how ;
5309   Thread *thr ;   5309   Thread *thr ;
5310   WordSetID wsA ;   5310   WordSetID wsA ;
5311   WordSetID wsW ;   5311   WordSetID wsW ;
5312   UWord *ls_words ;   5312   UWord *ls_words ;
5313   Word ls_size ;   5313   Word ls_size ;
5314   Word i ;   5314   Word i ;
5315   Lock *lk ;   5315   Lock *lk ;
5316   Bool tmp ;   5316   Bool tmp ;
5317   WordSet tmp___0 ;   5317   WordSet tmp___0 ;
5318   Bool tmp___1 ;   5318   Bool tmp___1 ;
5319   Bool tmp___2 ;   5319   Bool tmp___2 ;
5320     5320  
5321   {   5321   {
5322   how = (Char *)"no error";   5322   how = (Char *)"no error";
5323   thr = admin_threads;   5323   thr = admin_threads;
5324   while (thr) {   5324   while (thr) {
5325     tmp = vgHelgrind_is_sane_Thread(thr);   5325     tmp = vgHelgrind_is_sane_Thread(thr);
5326     if (tmp) {   5326     if (tmp) {
5327     5327  
5328     } else {   5328     } else {
5329       while (1) {   5329       while (1) {
5330         how = (Char *)"1";   5330         how = (Char *)"1";
5331         goto bad;   5331         goto bad;
5332         break;   5332         break;
5333       }   5333       }
5334     }   5334     }
5335     wsA = thr->locksetA;   5335     wsA = thr->locksetA;
5336     wsW = thr->locksetW;   5336     wsW = thr->locksetW;
5337     tmp___0 = vgHelgrind_isSubsetOf(univ_lsets, wsW, wsA);   5337     tmp___0 = vgHelgrind_isSubsetOf(univ_lsets, wsW, wsA);
5338     if (tmp___0) {   5338     if (tmp___0) {
5339     5339  
5340     } else {   5340     } else {
5341       while (1) {   5341       while (1) {
5342         how = (Char *)"7";   5342         how = (Char *)"7";
5343         goto bad;   5343         goto bad;
5344         break;   5344         break;
5345       }   5345       }
5346     }   5346     }
5347     vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets, wsA);   5347     vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets, wsA);
5348     i = (Word )0;   5348     i = (Word )0;
5349     while (i < ls_size) {   5349     while (i < ls_size) {
5350       lk = (Lock *)*(ls_words + i);   5350       lk = (Lock *)*(ls_words + i);
5351       tmp___1 = vgHelgrind_is_sane_LockN(lk);   5351       tmp___1 = vgHelgrind_is_sane_LockN(lk);
5352       if (tmp___1) {   5352       if (tmp___1) {
5353     5353  
5354       } else {   5354       } else {
5355         while (1) {   5355         while (1) {
5356           how = (Char *)"2";   5356           how = (Char *)"2";
5357           goto bad;   5357           goto bad;
5358           break;   5358           break;
5359         }   5359         }
5360       }   5360       }
5361       tmp___2 = thread_is_a_holder_of_Lock(thr, lk);   5361       tmp___2 = thread_is_a_holder_of_Lock(thr, lk);
5362       if (tmp___2) {   5362       if (tmp___2) {
5363     5363  
5364       } else {   5364       } else {
5365         while (1) {   5365         while (1) {
5366           how = (Char *)"3";   5366           how = (Char *)"3";
5367           goto bad;   5367           goto bad;
5368           break;   5368           break;
5369         }   5369         }
5370       }   5370       }
5371       i ++;   5371       i ++;
5372     }   5372     }
5373     thr = thr->admin;   5373     thr = thr->admin;
5374   }   5374   }
5375   return;   5375   return;
5376   bad:   5376   bad:
5377   vgPlain_printf("threads__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);   5377   vgPlain_printf("threads__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);
5378   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   5378   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
5379                       (Char const   *)"hg_main.c", 821,   5379                       (Char const   *)"hg_main.c", 821,
5380                       (Char const   *)"threads__sanity_check", "");   5380                       (Char const   *)"threads__sanity_check", "");
5381 }   5381 }
5382 }   5382 }
5383 static void ( __attribute__((__noinline__)) locks__sanity_check)(Char *who )   5383 static void ( __attribute__((__noinline__)) locks__sanity_check)(Char *who )
5384 {   5384 {
5385   Char *how ;   5385   Char *how ;
5386   Addr gla ;   5386   Addr gla ;
5387   Lock *lk ;   5387   Lock *lk ;
5388   Int i ;   5388   Int i ;
5389   UWord tmp ;   5389   UWord tmp ;
5390   Bool tmp___0 ;   5390   Bool tmp___0 ;
5391   Bool tmp___1 ;   5391   Bool tmp___1 ;
5392   Lock *tmp___2 ;   5392   Lock *tmp___2 ;
5393   Thread *thr ;   5393   Thread *thr ;
5394   Word count ;   5394   Word count ;
5395   Bool tmp___3 ;   5395   Bool tmp___3 ;
5396   Bool tmp___4 ;   5396   Bool tmp___4 ;
5397   Bool tmp___5 ;   5397   Bool tmp___5 ;
5398   Bool tmp___6 ;   5398   Bool tmp___6 ;
5399   Bool tmp___7 ;   5399   Bool tmp___7 ;
5400     5400  
5401   {   5401   {
5402   how = (Char *)"no error";   5402   how = (Char *)"no error";
5403   i = 0;   5403   i = 0;
5404   lk = admin_locks;   5404   lk = admin_locks;
5405   while (lk) {   5405   while (lk) {
5406     i ++;   5406     i ++;
5407     lk = lk->admin_next;   5407     lk = lk->admin_next;
5408   }   5408   }
5409   tmp = vgPlain_sizeFM(map_locks);   5409   tmp = vgPlain_sizeFM(map_locks);
5410   if ((UWord )i != tmp) {   5410   if ((UWord )i != tmp) {
5411     while (1) {   5411     while (1) {
5412       how = (Char *)"1";   5412       how = (Char *)"1";
5413       goto bad;   5413       goto bad;
5414       break;   5414       break;
5415     }   5415     }
5416   } else {   5416   } else {
5417     5417  
5418   }   5418   }
5419   vgPlain_initIterFM(map_locks);   5419   vgPlain_initIterFM(map_locks);
5420   while (1) {   5420   while (1) {
5421     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),   5421     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),
5422                                  (UWord *)((Word *)(& lk)));   5422                                  (UWord *)((Word *)(& lk)));
5423     if (tmp___0) {   5423     if (tmp___0) {
5424     5424  
5425     } else {   5425     } else {
5426       break;   5426       break;
5427     }   5427     }
5428     if (lk->guestaddr != gla) {   5428     if (lk->guestaddr != gla) {
5429       while (1) {   5429       while (1) {
5430         how = (Char *)"2";   5430         how = (Char *)"2";
5431         goto bad;   5431         goto bad;
5432         break;   5432         break;
5433       }   5433       }
5434     } else {   5434     } else {
5435     5435  
5436     }   5436     }
5437   }   5437   }
5438   vgPlain_doneIterFM(map_locks);   5438   vgPlain_doneIterFM(map_locks);
5439   lk = admin_locks;   5439   lk = admin_locks;
5440   while (lk) {   5440   while (lk) {
5441     tmp___1 = vgHelgrind_is_sane_LockN(lk);   5441     tmp___1 = vgHelgrind_is_sane_LockN(lk);
5442     if (tmp___1) {   5442     if (tmp___1) {
5443     5443  
5444     } else {   5444     } else {
5445       while (1) {   5445       while (1) {
5446         how = (Char *)"3";   5446         how = (Char *)"3";
5447         goto bad;   5447         goto bad;
5448         break;   5448         break;
5449       }   5449       }
5450     }   5450     }
5451     tmp___2 = map_locks_maybe_lookup(lk->guestaddr);   5451     tmp___2 = map_locks_maybe_lookup(lk->guestaddr);
5452     if ((unsigned int )lk != (unsigned int )tmp___2) {   5452     if ((unsigned int )lk != (unsigned int )tmp___2) {
5453       while (1) {   5453       while (1) {
5454         how = (Char *)"4";   5454         how = (Char *)"4";
5455         goto bad;   5455         goto bad;
5456         break;   5456         break;
5457       }   5457       }
5458     } else {   5458     } else {
5459     5459  
5460     }   5460     }
5461     if (lk->heldBy) {   5461     if (lk->heldBy) {
5462       vgPlain_initIterBag(lk->heldBy);   5462       vgPlain_initIterBag(lk->heldBy);
5463       while (1) {   5463       while (1) {
5464         tmp___7 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),   5464         tmp___7 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),
5465                                       (UWord *)(& count));   5465                                       (UWord *)(& count));
5466         if (tmp___7) {   5466         if (tmp___7) {
5467     5467  
5468         } else {   5468         } else {
5469           break;   5469           break;
5470         }   5470         }
5471         if (count >= 1L) {   5471         if (count >= 1L) {
5472     5472  
5473         } else {   5473         } else {
5474           vgPlain_assert_fail((Bool )0, (Char const   *)"count >= 1",   5474           vgPlain_assert_fail((Bool )0, (Char const   *)"count >= 1",
5475                               (Char const   *)"hg_main.c", 863,   5475                               (Char const   *)"hg_main.c", 863,
5476                               (Char const   *)"locks__sanity_check", "");   5476                               (Char const   *)"locks__sanity_check", "");
5477         }   5477         }
5478         tmp___3 = vgHelgrind_is_sane_Thread(thr);   5478         tmp___3 = vgHelgrind_is_sane_Thread(thr);
5479         if (tmp___3) {   5479         if (tmp___3) {
5480     5480  
5481         } else {   5481         } else {
5482           vgPlain_assert_fail((Bool )0,   5482           vgPlain_assert_fail((Bool )0,
5483                               (Char const   *)"HG_(is_sane_Thread)(thr)",   5483                               (Char const   *)"HG_(is_sane_Thread)(thr)",
5484                               (Char const   *)"hg_main.c", 864,   5484                               (Char const   *)"hg_main.c", 864,
5485                               (Char const   *)"locks__sanity_check", "");   5485                               (Char const   *)"locks__sanity_check", "");
5486         }   5486         }
5487         tmp___4 = vgHelgrind_elemWS(univ_lsets, thr->locksetA,   5487         tmp___4 = vgHelgrind_elemWS(univ_lsets, thr->locksetA,
5488                                     (UWord )((Word )lk));   5488                                     (UWord )((Word )lk));
5489         if (tmp___4) {   5489         if (tmp___4) {
5490     5490  
5491         } else {   5491         } else {
5492           while (1) {   5492           while (1) {
5493             how = (Char *)"6";   5493             how = (Char *)"6";
5494             goto bad;   5494             goto bad;
5495             break;   5495             break;
5496           }   5496           }
5497         }   5497         }
5498         if (lk->heldW) {   5498         if (lk->heldW) {
5499           tmp___5 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   5499           tmp___5 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
5500                                       (UWord )((Word )lk));   5500                                       (UWord )((Word )lk));
5501           if (tmp___5) {   5501           if (tmp___5) {
5502     5502  
5503           } else {   5503           } else {
5504             while (1) {   5504             while (1) {
5505               how = (Char *)"7";   5505               how = (Char *)"7";
5506               goto bad;   5506               goto bad;
5507               break;   5507               break;
5508             }   5508             }
5509           }   5509           }
5510         } else {   5510         } else {
5511     5511  
5512         }   5512         }
5513         if (! lk->heldW) {   5513         if (! lk->heldW) {
5514           tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   5514           tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
5515                                       (UWord )((Word )lk));   5515                                       (UWord )((Word )lk));
5516           if (tmp___6) {   5516           if (tmp___6) {
5517             while (1) {   5517             while (1) {
5518               how = (Char *)"8";   5518               how = (Char *)"8";
5519               goto bad;   5519               goto bad;
5520               break;   5520               break;
5521             }   5521             }
5522           } else {   5522           } else {
5523     5523  
5524           }   5524           }
5525         } else {   5525         } else {
5526     5526  
5527         }   5527         }
5528       }   5528       }
5529       vgPlain_doneIterBag(lk->heldBy);   5529       vgPlain_doneIterBag(lk->heldBy);
5530     } else   5530     } else
5531     if (lk->heldW) {   5531     if (lk->heldW) {
5532       while (1) {   5532       while (1) {
5533         how = (Char *)"9";   5533         how = (Char *)"9";
5534         goto bad;   5534         goto bad;
5535         break;   5535         break;
5536       }   5536       }
5537     } else {   5537     } else {
5538     5538  
5539     }   5539     }
5540     lk = lk->admin_next;   5540     lk = lk->admin_next;
5541   }   5541   }
5542   return;   5542   return;
5543   bad:   5543   bad:
5544   vgPlain_printf("locks__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);   5544   vgPlain_printf("locks__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);
5545   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   5545   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
5546                       (Char const   *)"hg_main.c", 887,   5546                       (Char const   *)"hg_main.c", 887,
5547                       (Char const   *)"locks__sanity_check", "");   5547                       (Char const   *)"locks__sanity_check", "");
5548 }   5548 }
5549 }   5549 }
5550 static void all_except_Locks__sanity_check(Char *who )   5550 static void all_except_Locks__sanity_check(Char *who )
5551 {   5551 {
5552     5552  
5553     5553  
5554   {   5554   {
5555   stats__sanity_checks ++;   5555   stats__sanity_checks ++;
5556   threads__sanity_check(who);   5556   threads__sanity_check(who);
5557   if (vgHelgrind_clo_track_lockorders) {   5557   if (vgHelgrind_clo_track_lockorders) {
5558     laog__sanity_check(who);   5558     laog__sanity_check(who);
5559   } else {   5559   } else {
5560     5560  
5561   }   5561   }
5562   return;   5562   return;
5563 }   5563 }
5564 }   5564 }
5565 static void all__sanity_check(Char *who )   5565 static void all__sanity_check(Char *who )
5566 {   5566 {
5567     5567  
5568     5568  
5569   {   5569   {
5570   all_except_Locks__sanity_check(who);   5570   all_except_Locks__sanity_check(who);
5571   locks__sanity_check(who);   5571   locks__sanity_check(who);
5572   return;   5572   return;
5573 }   5573 }
5574 }   5574 }
5575 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,   5575 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,
5576                                                                             Lock *lk ) ;   5576                                                                             Lock *lk ) ;
5577 __inline static Thread *get_current_Thread(void) ;   5577 __inline static Thread *get_current_Thread(void) ;
5578 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk ) ;   5578 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk ) ;
5579 static void shadow_mem_scopy_range(Thread *thr , Addr src , Addr dst ,   5579 static void shadow_mem_scopy_range(Thread *thr , Addr src , Addr dst ,
5580                                    SizeT len )   5580                                    SizeT len )
5581 {   5581 {
5582   Thr *hbthr ;   5582   Thr *hbthr ;
5583     5583  
5584   {   5584   {
5585   hbthr = thr->hbthr;   5585   hbthr = thr->hbthr;
5586   if (hbthr) {   5586   if (hbthr) {
5587     5587  
5588   } else {   5588   } else {
5589     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   5589     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
5590                         (Char const   *)"hg_main.c", 923,   5590                         (Char const   *)"hg_main.c", 923,
5591                         (Char const   *)"shadow_mem_scopy_range", "");   5591                         (Char const   *)"shadow_mem_scopy_range", "");
5592   }   5592   }
5593   libhb_copy_shadow_state(hbthr, src, dst, len);   5593   libhb_copy_shadow_state(hbthr, src, dst, len);
5594   return;   5594   return;
5595 }   5595 }
5596 }   5596 }
5597 static void shadow_mem_cread_range(Thread *thr , Addr a , SizeT len )   5597 static void shadow_mem_cread_range(Thread *thr , Addr a , SizeT len )
5598 {   5598 {
5599   Thr *hbthr ;   5599   Thr *hbthr ;
5600     5600  
5601   {   5601   {
5602   hbthr = thr->hbthr;   5602   hbthr = thr->hbthr;
5603   if (hbthr) {   5603   if (hbthr) {
5604     5604  
5605   } else {   5605   } else {
5606     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   5606     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
5607                         (Char const   *)"hg_main.c", 930,   5607                         (Char const   *)"hg_main.c", 930,
5608                         (Char const   *)"shadow_mem_cread_range", "");   5608                         (Char const   *)"shadow_mem_cread_range", "");
5609   }   5609   }
5610   zsm_sapplyNN_f__msmcread(hbthr, a, len);   5610   zsm_sapplyNN_f__msmcread(hbthr, a, len);
5611   return;   5611   return;
5612 }   5612 }
5613 }   5613 }
5614 static void shadow_mem_cwrite_range(Thread *thr , Addr a , SizeT len )   5614 static void shadow_mem_cwrite_range(Thread *thr , Addr a , SizeT len )
5615 {   5615 {
5616   Thr *hbthr ;   5616   Thr *hbthr ;
5617     5617  
5618   {   5618   {
5619   hbthr = thr->hbthr;   5619   hbthr = thr->hbthr;
5620   if (hbthr) {   5620   if (hbthr) {
5621     5621  
5622   } else {   5622   } else {
5623     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   5623     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
5624                         (Char const   *)"hg_main.c", 936,   5624                         (Char const   *)"hg_main.c", 936,
5625                         (Char const   *)"shadow_mem_cwrite_range", "");   5625                         (Char const   *)"shadow_mem_cwrite_range", "");
5626   }   5626   }
5627   zsm_sapplyNN_f__msmcwrite(hbthr, a, len);   5627   zsm_sapplyNN_f__msmcwrite(hbthr, a, len);
5628   return;   5628   return;
5629 }   5629 }
5630 }   5630 }
5631 static void shadow_mem_make_New(Thread *thr , Addr a , SizeT len )   5631 static void shadow_mem_make_New(Thread *thr , Addr a , SizeT len )
5632 {   5632 {
5633     5633  
5634     5634  
5635   {   5635   {
5636   libhb_srange_new(thr->hbthr, a, len);   5636   libhb_srange_new(thr->hbthr, a, len);
5637   return;   5637   return;
5638 }   5638 }
5639 }   5639 }
5640 static void shadow_mem_make_NoAccess(Thread *thr , Addr aIN , SizeT len )   5640 static void shadow_mem_make_NoAccess(Thread *thr , Addr aIN , SizeT len )
5641 {   5641 {
5642     5642  
5643     5643  
5644   {   5644   {
5645   libhb_srange_noaccess(thr->hbthr, aIN, len);   5645   libhb_srange_noaccess(thr->hbthr, aIN, len);
5646   return;   5646   return;
5647 }   5647 }
5648 }   5648 }
5649 static void shadow_mem_make_Untracked(Thread *thr , Addr aIN , SizeT len )   5649 static void shadow_mem_make_Untracked(Thread *thr , Addr aIN , SizeT len )
5650 {   5650 {
5651     5651  
5652     5652  
5653   {   5653   {
5654   libhb_srange_untrack(thr->hbthr, aIN, len);   5654   libhb_srange_untrack(thr->hbthr, aIN, len);
5655   return;   5655   return;
5656 }   5656 }
5657 }   5657 }
5658 static void evhH__post_thread_w_acquires_lock(Thread *thr , LockKind lkk ,   5658 static void evhH__post_thread_w_acquires_lock(Thread *thr , LockKind lkk ,
5659                                               Addr lock_ga )   5659                                               Addr lock_ga )
5660 {   5660 {
5661   Lock *lk ;   5661   Lock *lk ;
5662   Bool tmp ;   5662   Bool tmp ;
5663   ThreadId tmp___0 ;   5663   ThreadId tmp___0 ;
5664   Bool tmp___1 ;   5664   Bool tmp___1 ;
5665   UWord tmp___2 ;   5665   UWord tmp___2 ;
5666   UWord tmp___3 ;   5666   UWord tmp___3 ;
5667   Bool tmp___4 ;   5667   Bool tmp___4 ;
5668     5668  
5669   {   5669   {
5670   tmp = vgHelgrind_is_sane_Thread(thr);   5670   tmp = vgHelgrind_is_sane_Thread(thr);
5671   if (tmp) {   5671   if (tmp) {
5672     5672  
5673   } else {   5673   } else {
5674     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5674     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5675                         (Char const   *)"hg_main.c", 1010,   5675                         (Char const   *)"hg_main.c", 1010,
5676                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5676                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5677   }   5677   }
5678   tmp___0 = map_threads_reverse_lookup_SLOW(thr);   5678   tmp___0 = map_threads_reverse_lookup_SLOW(thr);
5679   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);   5679   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);
5680   tmp___1 = vgHelgrind_is_sane_LockN(lk);   5680   tmp___1 = vgHelgrind_is_sane_LockN(lk);
5681   if (tmp___1) {   5681   if (tmp___1) {
5682     5682  
5683   } else {   5683   } else {
5684     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5684     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5685                         (Char const   *)"hg_main.c", 1015,   5685                         (Char const   *)"hg_main.c", 1015,
5686                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5686                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5687   }   5687   }
5688   if (thr->hbthr) {   5688   if (thr->hbthr) {
5689     5689  
5690   } else {   5690   } else {
5691     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   5691     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
5692                         (Char const   *)"hg_main.c", 1018,   5692                         (Char const   *)"hg_main.c", 1018,
5693                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5693                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5694   }   5694   }
5695   if (lk->hbso) {   5695   if (lk->hbso) {
5696     5696  
5697   } else {   5697   } else {
5698     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",   5698     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",
5699                         (Char const   *)"hg_main.c", 1019,   5699                         (Char const   *)"hg_main.c", 1019,
5700                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5700                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5701   }   5701   }
5702   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   5702   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
5703     if (! lk->heldW) {   5703     if (! lk->heldW) {
5704     5704  
5705     } else {   5705     } else {
5706       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   5706       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
5707                           (Char const   *)"hg_main.c", 1023,   5707                           (Char const   *)"hg_main.c", 1023,
5708                           (Char const   *)"evhH__post_thread_w_acquires_lock",   5708                           (Char const   *)"evhH__post_thread_w_acquires_lock",
5709                           "");   5709                           "");
5710     }   5710     }
5711     lockN_acquire_writer(lk, thr);   5711     lockN_acquire_writer(lk, thr);
5712     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);   5712     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);
5713     goto noerror;   5713     goto noerror;
5714   } else {   5714   } else {
5715     5715  
5716   }   5716   }
5717   if (lk->heldBy) {   5717   if (lk->heldBy) {
5718     5718  
5719   } else {   5719   } else {
5720     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",   5720     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",
5721                         (Char const   *)"hg_main.c", 1032,   5721                         (Char const   *)"hg_main.c", 1032,
5722                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5722                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5723   }   5723   }
5724   if (! lk->heldW) {   5724   if (! lk->heldW) {
5725     vgHelgrind_record_error_Misc(thr,   5725     vgHelgrind_record_error_Misc(thr,
5726                                  (HChar *)"Bug in libpthread: write lock granted on rwlock which is currently rd-held");   5726                                  (HChar *)"Bug in libpthread: write lock granted on rwlock which is currently rd-held");
5727     goto error;   5727     goto error;
5728   } else {   5728   } else {
5729     5729  
5730   }   5730   }
5731   tmp___2 = vgPlain_sizeUniqueBag(lk->heldBy);   5731   tmp___2 = vgPlain_sizeUniqueBag(lk->heldBy);
5732   if (tmp___2 == 1UL) {   5732   if (tmp___2 == 1UL) {
5733     5733  
5734   } else {   5734   } else {
5735     vgPlain_assert_fail((Bool )0,   5735     vgPlain_assert_fail((Bool )0,
5736                         (Char const   *)"VG_(sizeUniqueBag)(lk->heldBy) == 1",   5736                         (Char const   *)"VG_(sizeUniqueBag)(lk->heldBy) == 1",
5737                         (Char const   *)"hg_main.c", 1042,   5737                         (Char const   *)"hg_main.c", 1042,
5738                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5738                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5739   }   5739   }
5740   tmp___3 = vgPlain_anyElementOfBag(lk->heldBy);   5740   tmp___3 = vgPlain_anyElementOfBag(lk->heldBy);
5741   if ((unsigned int )thr != (unsigned int )((Thread *)tmp___3)) {   5741   if ((unsigned int )thr != (unsigned int )((Thread *)tmp___3)) {
5742     vgHelgrind_record_error_Misc(thr,   5742     vgHelgrind_record_error_Misc(thr,
5743                                  (HChar *)"Bug in libpthread: write lock granted on mutex/rwlock which is currently wr-held by a different thread");   5743                                  (HChar *)"Bug in libpthread: write lock granted on mutex/rwlock which is currently wr-held by a different thread");
5744     goto error;   5744     goto error;
5745   } else {   5745   } else {
5746     5746  
5747   }   5747   }
5748   if ((unsigned int )lk->kind != 1001U) {   5748   if ((unsigned int )lk->kind != 1001U) {
5749     vgHelgrind_record_error_Misc(thr,   5749     vgHelgrind_record_error_Misc(thr,
5750                                  (HChar *)"Bug in libpthread: recursive write lock granted on mutex/wrlock which does not support recursion");   5750                                  (HChar *)"Bug in libpthread: recursive write lock granted on mutex/wrlock which does not support recursion");
5751     goto error;   5751     goto error;
5752   } else {   5752   } else {
5753     5753  
5754   }   5754   }
5755   lockN_acquire_writer(lk, thr);   5755   lockN_acquire_writer(lk, thr);
5756   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);   5756   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);
5757   goto noerror;   5757   goto noerror;
5758   noerror:   5758   noerror:
5759   if (vgHelgrind_clo_track_lockorders) {   5759   if (vgHelgrind_clo_track_lockorders) {
5760     laog__pre_thread_acquires_lock(thr, lk);   5760     laog__pre_thread_acquires_lock(thr, lk);
5761   } else {   5761   } else {
5762     5762  
5763   }   5763   }
5764   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,   5764   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,
5765                                      (UWord )((Word )lk));   5765                                      (UWord )((Word )lk));
5766   thr->locksetW = vgHelgrind_addToWS(univ_lsets, thr->locksetW,   5766   thr->locksetW = vgHelgrind_addToWS(univ_lsets, thr->locksetW,
5767                                      (UWord )((Word )lk));   5767                                      (UWord )((Word )lk));
5768   error:   5768   error:
5769   tmp___4 = vgHelgrind_is_sane_LockN(lk);   5769   tmp___4 = vgHelgrind_is_sane_LockN(lk);
5770   if (tmp___4) {   5770   if (tmp___4) {
5771     5771  
5772   } else {   5772   } else {
5773     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5773     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5774                         (Char const   *)"hg_main.c", 1084,   5774                         (Char const   *)"hg_main.c", 1084,
5775                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5775                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5776   }   5776   }
5777   return;   5777   return;
5778 }   5778 }
5779 }   5779 }
5780 static void evhH__post_thread_r_acquires_lock(Thread *thr , LockKind lkk ,   5780 static void evhH__post_thread_r_acquires_lock(Thread *thr , LockKind lkk ,
5781                                               Addr lock_ga )   5781                                               Addr lock_ga )
5782 {   5782 {
5783   Lock *lk ;   5783   Lock *lk ;
5784   Bool tmp ;   5784   Bool tmp ;
5785   ThreadId tmp___0 ;   5785   ThreadId tmp___0 ;
5786   Bool tmp___1 ;   5786   Bool tmp___1 ;
5787   Bool tmp___2 ;   5787   Bool tmp___2 ;
5788     5788  
5789   {   5789   {
5790   tmp = vgHelgrind_is_sane_Thread(thr);   5790   tmp = vgHelgrind_is_sane_Thread(thr);
5791   if (tmp) {   5791   if (tmp) {
5792     5792  
5793   } else {   5793   } else {
5794     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5794     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5795                         (Char const   *)"hg_main.c", 1107,   5795                         (Char const   *)"hg_main.c", 1107,
5796                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5796                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5797   }   5797   }
5798   if ((unsigned int )lkk == 1003U) {   5798   if ((unsigned int )lkk == 1003U) {
5799     5799  
5800   } else {   5800   } else {
5801     vgPlain_assert_fail((Bool )0, (Char const   *)"lkk == LK_rdwr",   5801     vgPlain_assert_fail((Bool )0, (Char const   *)"lkk == LK_rdwr",
5802                         (Char const   *)"hg_main.c", 1111,   5802                         (Char const   *)"hg_main.c", 1111,
5803                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5803                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5804   }   5804   }
5805   tmp___0 = map_threads_reverse_lookup_SLOW(thr);   5805   tmp___0 = map_threads_reverse_lookup_SLOW(thr);
5806   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);   5806   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);
5807   tmp___1 = vgHelgrind_is_sane_LockN(lk);   5807   tmp___1 = vgHelgrind_is_sane_LockN(lk);
5808   if (tmp___1) {   5808   if (tmp___1) {
5809     5809  
5810   } else {   5810   } else {
5811     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5811     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5812                         (Char const   *)"hg_main.c", 1114,   5812                         (Char const   *)"hg_main.c", 1114,
5813                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5813                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5814   }   5814   }
5815   if (thr->hbthr) {   5815   if (thr->hbthr) {
5816     5816  
5817   } else {   5817   } else {
5818     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   5818     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
5819                         (Char const   *)"hg_main.c", 1117,   5819                         (Char const   *)"hg_main.c", 1117,
5820                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5820                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5821   }   5821   }
5822   if (lk->hbso) {   5822   if (lk->hbso) {
5823     5823  
5824   } else {   5824   } else {
5825     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",   5825     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",
5826                         (Char const   *)"hg_main.c", 1118,   5826                         (Char const   *)"hg_main.c", 1118,
5827                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5827                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5828   }   5828   }
5829   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   5829   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
5830     if (! lk->heldW) {   5830     if (! lk->heldW) {
5831     5831  
5832     } else {   5832     } else {
5833       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   5833       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
5834                           (Char const   *)"hg_main.c", 1122,   5834                           (Char const   *)"hg_main.c", 1122,
5835                           (Char const   *)"evhH__post_thread_r_acquires_lock",   5835                           (Char const   *)"evhH__post_thread_r_acquires_lock",
5836                           "");   5836                           "");
5837     }   5837     }
5838     lockN_acquire_reader(lk, thr);   5838     lockN_acquire_reader(lk, thr);
5839     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);   5839     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);
5840     goto noerror;   5840     goto noerror;
5841   } else {   5841   } else {
5842     5842  
5843   }   5843   }
5844   if (lk->heldBy) {   5844   if (lk->heldBy) {
5845     5845  
5846   } else {   5846   } else {
5847     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",   5847     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",
5848                         (Char const   *)"hg_main.c", 1131,   5848                         (Char const   *)"hg_main.c", 1131,
5849                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5849                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5850   }   5850   }
5851   if (lk->heldW) {   5851   if (lk->heldW) {
5852     vgHelgrind_record_error_Misc(thr,   5852     vgHelgrind_record_error_Misc(thr,
5853                                  (HChar *)"Bug in libpthread: read lock granted on rwlock which is currently wr-held");   5853                                  (HChar *)"Bug in libpthread: read lock granted on rwlock which is currently wr-held");
5854     goto error;   5854     goto error;
5855   } else {   5855   } else {
5856     5856  
5857   }   5857   }
5858   lockN_acquire_reader(lk, thr);   5858   lockN_acquire_reader(lk, thr);
5859   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);   5859   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);
5860   goto noerror;   5860   goto noerror;
5861   noerror:   5861   noerror:
5862   if (vgHelgrind_clo_track_lockorders) {   5862   if (vgHelgrind_clo_track_lockorders) {
5863     laog__pre_thread_acquires_lock(thr, lk);   5863     laog__pre_thread_acquires_lock(thr, lk);
5864   } else {   5864   } else {
5865     5865  
5866   }   5866   }
5867   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,   5867   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,
5868                                      (UWord )((Word )lk));   5868                                      (UWord )((Word )lk));
5869   error:   5869   error:
5870   tmp___2 = vgHelgrind_is_sane_LockN(lk);   5870   tmp___2 = vgHelgrind_is_sane_LockN(lk);
5871   if (tmp___2) {   5871   if (tmp___2) {
5872     5872  
5873   } else {   5873   } else {
5874     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5874     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5875                         (Char const   *)"hg_main.c", 1159,   5875                         (Char const   *)"hg_main.c", 1159,
5876                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5876                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5877   }   5877   }
5878   return;   5878   return;
5879 }   5879 }
5880 }   5880 }
5881 static void evhH__pre_thread_releases_lock(Thread *thr , Addr lock_ga ,   5881 static void evhH__pre_thread_releases_lock(Thread *thr , Addr lock_ga ,
5882                                            Bool isRDWR )   5882                                            Bool isRDWR )
5883 {   5883 {
5884   Lock *lock ;   5884   Lock *lock ;
5885   Word n ;   5885   Word n ;
5886   Bool was_heldW ;   5886   Bool was_heldW ;
5887   Bool tmp ;   5887   Bool tmp ;
5888   Bool tmp___0 ;   5888   Bool tmp___0 ;
5889   Bool tmp___1 ;   5889   Bool tmp___1 ;
5890   Bool tmp___2 ;   5890   Bool tmp___2 ;
5891   UWord tmp___3 ;   5891   UWord tmp___3 ;
5892   Thread *realOwner ;   5892   Thread *realOwner ;
5893   UWord tmp___4 ;   5893   UWord tmp___4 ;
5894   Bool tmp___5 ;   5894   Bool tmp___5 ;
5895   Bool tmp___6 ;   5895   Bool tmp___6 ;
5896   Bool tmp___7 ;   5896   Bool tmp___7 ;
5897   UWord tmp___8 ;   5897   UWord tmp___8 ;
5898   Bool tmp___9 ;   5898   Bool tmp___9 ;
5899   Bool tmp___10 ;   5899   Bool tmp___10 ;
5900   Bool tmp___11 ;   5900   Bool tmp___11 ;
5901   Bool tmp___12 ;   5901   Bool tmp___12 ;
5902     5902  
5903   {   5903   {
5904   tmp = vgHelgrind_is_sane_Thread(thr);   5904   tmp = vgHelgrind_is_sane_Thread(thr);
5905   if (tmp) {   5905   if (tmp) {
5906     5906  
5907   } else {   5907   } else {
5908     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5908     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5909                         (Char const   *)"hg_main.c", 1182,   5909                         (Char const   *)"hg_main.c", 1182,
5910                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5910                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5911   }   5911   }
5912   lock = map_locks_maybe_lookup(lock_ga);   5912   lock = map_locks_maybe_lookup(lock_ga);
5913   if (! lock) {   5913   if (! lock) {
5914     vgHelgrind_record_error_UnlockBogus(thr, lock_ga);   5914     vgHelgrind_record_error_UnlockBogus(thr, lock_ga);
5915     return;   5915     return;
5916   } else {   5916   } else {
5917     5917  
5918   }   5918   }
5919   if (lock->guestaddr == lock_ga) {   5919   if (lock->guestaddr == lock_ga) {
5920     5920  
5921   } else {   5921   } else {
5922     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->guestaddr == lock_ga",   5922     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->guestaddr == lock_ga",
5923                         (Char const   *)"hg_main.c", 1193,   5923                         (Char const   *)"hg_main.c", 1193,
5924                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5924                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5925   }   5925   }
5926   tmp___0 = vgHelgrind_is_sane_LockN(lock);   5926   tmp___0 = vgHelgrind_is_sane_LockN(lock);
5927   if (tmp___0) {   5927   if (tmp___0) {
5928     5928  
5929   } else {   5929   } else {
5930     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   5930     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
5931                         (Char const   *)"hg_main.c", 1194,   5931                         (Char const   *)"hg_main.c", 1194,
5932                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5932                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5933   }   5933   }
5934   if (isRDWR) {   5934   if (isRDWR) {
5935     if ((unsigned int )lock->kind != 1003U) {   5935     if ((unsigned int )lock->kind != 1003U) {
5936       vgHelgrind_record_error_Misc(thr,   5936       vgHelgrind_record_error_Misc(thr,
5937                                    (HChar *)"pthread_rwlock_unlock with a pthread_mutex_t* argument ");   5937                                    (HChar *)"pthread_rwlock_unlock with a pthread_mutex_t* argument ");
5938     } else {   5938     } else {
5939     5939  
5940     }   5940     }
5941   } else {   5941   } else {
5942     5942  
5943   }   5943   }
5944   if (! isRDWR) {   5944   if (! isRDWR) {
5945     if ((unsigned int )lock->kind == 1003U) {   5945     if ((unsigned int )lock->kind == 1003U) {
5946       vgHelgrind_record_error_Misc(thr,   5946       vgHelgrind_record_error_Misc(thr,
5947                                    (HChar *)"pthread_mutex_unlock with a pthread_rwlock_t* argument ");   5947                                    (HChar *)"pthread_mutex_unlock with a pthread_rwlock_t* argument ");
5948     } else {   5948     } else {
5949     5949  
5950     }   5950     }
5951   } else {   5951   } else {
5952     5952  
5953   }   5953   }
5954   if (! lock->heldBy) {   5954   if (! lock->heldBy) {
5955     if (! lock->heldW) {   5955     if (! lock->heldW) {
5956     5956  
5957     } else {   5957     } else {
5958       vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldW",   5958       vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldW",
5959                           (Char const   *)"hg_main.c", 1208,   5959                           (Char const   *)"hg_main.c", 1208,
5960                           (Char const   *)"evhH__pre_thread_releases_lock", "");   5960                           (Char const   *)"evhH__pre_thread_releases_lock", "");
5961     }   5961     }
5962     vgHelgrind_record_error_UnlockUnlocked(thr, lock);   5962     vgHelgrind_record_error_UnlockUnlocked(thr, lock);
5963     tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));   5963     tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));
5964     if (tmp___1) {   5964     if (tmp___1) {
5965       vgPlain_assert_fail((Bool )0,   5965       vgPlain_assert_fail((Bool )0,
5966                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",   5966                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",
5967                           (Char const   *)"hg_main.c", 1210,   5967                           (Char const   *)"hg_main.c", 1210,
5968                           (Char const   *)"evhH__pre_thread_releases_lock", "");   5968                           (Char const   *)"evhH__pre_thread_releases_lock", "");
5969     } else {   5969     } else {
5970     5970  
5971     }   5971     }
5972     tmp___2 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));   5972     tmp___2 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));
5973     if (tmp___2) {   5973     if (tmp___2) {
5974       vgPlain_assert_fail((Bool )0,   5974       vgPlain_assert_fail((Bool )0,
5975                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   5975                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
5976                           (Char const   *)"hg_main.c", 1211,   5976                           (Char const   *)"hg_main.c", 1211,
5977                           (Char const   *)"evhH__pre_thread_releases_lock", "");   5977                           (Char const   *)"evhH__pre_thread_releases_lock", "");
5978     } else {   5978     } else {
5979     5979  
5980     }   5980     }
5981     goto error;   5981     goto error;
5982   } else {   5982   } else {
5983     5983  
5984   }   5984   }
5985   if (lock->heldBy) {   5985   if (lock->heldBy) {
5986     5986  
5987   } else {   5987   } else {
5988     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",   5988     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",
5989                         (Char const   *)"hg_main.c", 1216,   5989                         (Char const   *)"hg_main.c", 1216,
5990                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5990                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5991   }   5991   }
5992   was_heldW = lock->heldW;   5992   was_heldW = lock->heldW;
5993   tmp___3 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));   5993   tmp___3 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));
5994   n = (Word )tmp___3;   5994   n = (Word )tmp___3;
5995   if (n >= 0L) {   5995   if (n >= 0L) {
5996     5996  
5997   } else {   5997   } else {
5998     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",   5998     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",
5999                         (Char const   *)"hg_main.c", 1222,   5999                         (Char const   *)"hg_main.c", 1222,
6000                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6000                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6001   }   6001   }
6002   if (n == 0L) {   6002   if (n == 0L) {
6003     tmp___4 = vgPlain_anyElementOfBag(lock->heldBy);   6003     tmp___4 = vgPlain_anyElementOfBag(lock->heldBy);
6004     realOwner = (Thread *)tmp___4;   6004     realOwner = (Thread *)tmp___4;
6005     tmp___5 = vgHelgrind_is_sane_Thread(realOwner);   6005     tmp___5 = vgHelgrind_is_sane_Thread(realOwner);
6006     if (tmp___5) {   6006     if (tmp___5) {
6007     6007  
6008     } else {   6008     } else {
6009       vgPlain_assert_fail((Bool )0,   6009       vgPlain_assert_fail((Bool )0,
6010                           (Char const   *)"HG_(is_sane_Thread)(realOwner)",   6010                           (Char const   *)"HG_(is_sane_Thread)(realOwner)",
6011                           (Char const   *)"hg_main.c", 1229,   6011                           (Char const   *)"hg_main.c", 1229,
6012                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6012                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6013     }   6013     }
6014     if ((unsigned int )realOwner != (unsigned int )thr) {   6014     if ((unsigned int )realOwner != (unsigned int )thr) {
6015     6015  
6016     } else {   6016     } else {
6017       vgPlain_assert_fail((Bool )0, (Char const   *)"realOwner != thr",   6017       vgPlain_assert_fail((Bool )0, (Char const   *)"realOwner != thr",
6018                           (Char const   *)"hg_main.c", 1230,   6018                           (Char const   *)"hg_main.c", 1230,
6019                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6019                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6020     }   6020     }
6021     tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));   6021     tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));
6022     if (tmp___6) {   6022     if (tmp___6) {
6023       vgPlain_assert_fail((Bool )0,   6023       vgPlain_assert_fail((Bool )0,
6024                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",   6024                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",
6025                           (Char const   *)"hg_main.c", 1231,   6025                           (Char const   *)"hg_main.c", 1231,
6026                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6026                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6027     } else {   6027     } else {
6028     6028  
6029     }   6029     }
6030     tmp___7 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));   6030     tmp___7 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));
6031     if (tmp___7) {   6031     if (tmp___7) {
6032       vgPlain_assert_fail((Bool )0,   6032       vgPlain_assert_fail((Bool )0,
6033                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   6033                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
6034                           (Char const   *)"hg_main.c", 1232,   6034                           (Char const   *)"hg_main.c", 1232,
6035                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6035                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6036     } else {   6036     } else {
6037     6037  
6038     }   6038     }
6039     vgHelgrind_record_error_UnlockForeign(thr, realOwner, lock);   6039     vgHelgrind_record_error_UnlockForeign(thr, realOwner, lock);
6040     goto error;   6040     goto error;
6041   } else {   6041   } else {
6042     6042  
6043   }   6043   }
6044   if (n >= 1L) {   6044   if (n >= 1L) {
6045     6045  
6046   } else {   6046   } else {
6047     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 1",   6047     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 1",
6048                         (Char const   *)"hg_main.c", 1238,   6048                         (Char const   *)"hg_main.c", 1238,
6049                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6049                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6050   }   6050   }
6051   lockN_release(lock, thr);   6051   lockN_release(lock, thr);
6052   n --;   6052   n --;
6053   if (n >= 0L) {   6053   if (n >= 0L) {
6054     6054  
6055   } else {   6055   } else {
6056     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",   6056     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",
6057                         (Char const   *)"hg_main.c", 1243,   6057                         (Char const   *)"hg_main.c", 1243,
6058                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6058                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6059   }   6059   }
6060   if (n > 0L) {   6060   if (n > 0L) {
6061     if (lock->heldBy) {   6061     if (lock->heldBy) {
6062     6062  
6063     } else {   6063     } else {
6064       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",   6064       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",
6065                           (Char const   *)"hg_main.c", 1246,   6065                           (Char const   *)"hg_main.c", 1246,
6066                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6066                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6067     }   6067     }
6068     tmp___8 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));   6068     tmp___8 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));
6069     if ((UWord )n == tmp___8) {   6069     if ((UWord )n == tmp___8) {
6070     6070  
6071     } else {   6071     } else {
6072       vgPlain_assert_fail((Bool )0,   6072       vgPlain_assert_fail((Bool )0,
6073                           (Char const   *)"n == VG_(elemBag)( lock->heldBy, (Word)thr )",   6073                           (Char const   *)"n == VG_(elemBag)( lock->heldBy, (Word)thr )",
6074                           (Char const   *)"hg_main.c", 1247,   6074                           (Char const   *)"hg_main.c", 1247,
6075                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6075                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6076     }   6076     }
6077     if ((unsigned int )lock->kind == 1001U) {   6077     if ((unsigned int )lock->kind == 1001U) {
6078     6078  
6079     } else   6079     } else
6080     if ((unsigned int )lock->kind == 1003U) {   6080     if ((unsigned int )lock->kind == 1003U) {
6081       if (! lock->heldW) {   6081       if (! lock->heldW) {
6082     6082  
6083       } else {   6083       } else {
6084         vgPlain_assert_fail((Bool )0,   6084         vgPlain_assert_fail((Bool )0,
6085                             (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",   6085                             (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",
6086                             (Char const   *)"hg_main.c", 1251,   6086                             (Char const   *)"hg_main.c", 1251,
6087                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6087                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6088       }   6088       }
6089     } else {   6089     } else {
6090       vgPlain_assert_fail((Bool )0,   6090       vgPlain_assert_fail((Bool )0,
6091                           (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",   6091                           (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",
6092                           (Char const   *)"hg_main.c", 1251,   6092                           (Char const   *)"hg_main.c", 1251,
6093                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6093                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6094     }   6094     }
6095     tmp___9 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));   6095     tmp___9 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));
6096     if (tmp___9) {   6096     if (tmp___9) {
6097     6097  
6098     } else {   6098     } else {
6099       vgPlain_assert_fail((Bool )0,   6099       vgPlain_assert_fail((Bool )0,
6100                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",   6100                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",
6101                           (Char const   *)"hg_main.c", 1252,   6101                           (Char const   *)"hg_main.c", 1252,
6102                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6102                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6103     }   6103     }
6104     if (lock->heldW) {   6104     if (lock->heldW) {
6105       tmp___10 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   6105       tmp___10 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
6106                                    (UWord )((Word )lock));   6106                                    (UWord )((Word )lock));
6107       if (tmp___10) {   6107       if (tmp___10) {
6108     6108  
6109       } else {   6109       } else {
6110         vgPlain_assert_fail((Bool )0,   6110         vgPlain_assert_fail((Bool )0,
6111                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   6111                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
6112                             (Char const   *)"hg_main.c", 1254,   6112                             (Char const   *)"hg_main.c", 1254,
6113                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6113                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6114       }   6114       }
6115     } else {   6115     } else {
6116       tmp___11 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   6116       tmp___11 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
6117                                    (UWord )((Word )lock));   6117                                    (UWord )((Word )lock));
6118       if (tmp___11) {   6118       if (tmp___11) {
6119         vgPlain_assert_fail((Bool )0,   6119         vgPlain_assert_fail((Bool )0,
6120                             (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   6120                             (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
6121                             (Char const   *)"hg_main.c", 1256,   6121                             (Char const   *)"hg_main.c", 1256,
6122                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6122                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6123       } else {   6123       } else {
6124     6124  
6125       }   6125       }
6126     }   6126     }
6127   } else {   6127   } else {
6128     if ((unsigned int )lock->kind == 1003U) {   6128     if ((unsigned int )lock->kind == 1003U) {
6129       if (lock->heldBy) {   6129       if (lock->heldBy) {
6130         if ((int )lock->heldW == 0) {   6130         if ((int )lock->heldW == 0) {
6131     6131  
6132         } else {   6132         } else {
6133           vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",   6133           vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",
6134                               (Char const   *)"hg_main.c", 1269,   6134                               (Char const   *)"hg_main.c", 1269,
6135                               (Char const   *)"evhH__pre_thread_releases_lock",   6135                               (Char const   *)"evhH__pre_thread_releases_lock",
6136                               "");   6136                               "");
6137         }   6137         }
6138       } else {   6138       } else {
6139         goto _L;   6139         goto _L;
6140       }   6140       }
6141     } else {   6141     } else {
6142       _L: /* CIL Label */   6142       _L: /* CIL Label */
6143       if (! lock->heldBy) {   6143       if (! lock->heldBy) {
6144     6144  
6145       } else {   6145       } else {
6146         vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldBy",   6146         vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldBy",
6147                             (Char const   *)"hg_main.c", 1278,   6147                             (Char const   *)"hg_main.c", 1278,
6148                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6148                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6149       }   6149       }
6150       if ((int )lock->heldW == 0) {   6150       if ((int )lock->heldW == 0) {
6151     6151  
6152       } else {   6152       } else {
6153         vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",   6153         vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",
6154                             (Char const   *)"hg_main.c", 1279,   6154                             (Char const   *)"hg_main.c", 1279,
6155                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6155                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6156       }   6156       }
6157     }   6157     }
6158     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,   6158     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,
6159                                          (UWord )((Word )lock));   6159                                          (UWord )((Word )lock));
6160     thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,   6160     thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,
6161                                          (UWord )((Word )lock));   6161                                          (UWord )((Word )lock));
6162     if (thr->hbthr) {   6162     if (thr->hbthr) {
6163     6163  
6164     } else {   6164     } else {
6165       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   6165       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
6166                           (Char const   *)"hg_main.c", 1290,   6166                           (Char const   *)"hg_main.c", 1290,
6167                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6167                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6168     }   6168     }
6169     if (lock->hbso) {   6169     if (lock->hbso) {
6170     6170  
6171     } else {   6171     } else {
6172       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->hbso",   6172       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->hbso",
6173                           (Char const   *)"hg_main.c", 1291,   6173                           (Char const   *)"hg_main.c", 1291,
6174                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6174                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6175     }   6175     }
6176     libhb_so_send(thr->hbthr, lock->hbso, was_heldW);   6176     libhb_so_send(thr->hbthr, lock->hbso, was_heldW);
6177   }   6177   }
6178   error:   6178   error:
6179   tmp___12 = vgHelgrind_is_sane_LockN(lock);   6179   tmp___12 = vgHelgrind_is_sane_LockN(lock);
6180   if (tmp___12) {   6180   if (tmp___12) {
6181     6181  
6182   } else {   6182   } else {
6183     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   6183     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
6184                         (Char const   *)"hg_main.c", 1299,   6184                         (Char const   *)"hg_main.c", 1299,
6185                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6185                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6186   }   6186   }
6187   return;   6187   return;
6188 }   6188 }
6189 }   6189 }
6190 static Thread *current_Thread  =    (Thread *)((void *)0);   6190 static Thread *current_Thread  =    (Thread *)((void *)0);
6191 static Thread *current_Thread_prev  =    (Thread *)((void *)0);   6191 static Thread *current_Thread_prev  =    (Thread *)((void *)0);
6192 static void evh__start_client_code(ThreadId tid , ULong nDisp )   6192 static void evh__start_client_code(ThreadId tid , ULong nDisp )
6193 {   6193 {
6194     6194  
6195     6195  
6196   {   6196   {
6197   if ((unsigned int )current_Thread == (unsigned int )((void *)0)) {   6197   if ((unsigned int )current_Thread == (unsigned int )((void *)0)) {
6198     6198  
6199   } else {   6199   } else {
6200     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread == NULL",   6200     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread == NULL",
6201                         (Char const   *)"hg_main.c", 1328,   6201                         (Char const   *)"hg_main.c", 1328,
6202                         (Char const   *)"evh__start_client_code", "");   6202                         (Char const   *)"evh__start_client_code", "");
6203   }   6203   }
6204   current_Thread = map_threads_lookup(tid);   6204   current_Thread = map_threads_lookup(tid);
6205   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {   6205   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {
6206     6206  
6207   } else {   6207   } else {
6208     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",   6208     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",
6209                         (Char const   *)"hg_main.c", 1330,   6209                         (Char const   *)"hg_main.c", 1330,
6210                         (Char const   *)"evh__start_client_code", "");   6210                         (Char const   *)"evh__start_client_code", "");
6211   }   6211   }
6212   if ((unsigned int )current_Thread != (unsigned int )current_Thread_prev) {   6212   if ((unsigned int )current_Thread != (unsigned int )current_Thread_prev) {
6213     libhb_Thr_resumes(current_Thread->hbthr);   6213     libhb_Thr_resumes(current_Thread->hbthr);
6214     current_Thread_prev = current_Thread;   6214     current_Thread_prev = current_Thread;
6215   } else {   6215   } else {
6216     6216  
6217   }   6217   }
6218   return;   6218   return;
6219 }   6219 }
6220 }   6220 }
6221 static void evh__stop_client_code(ThreadId tid , ULong nDisp )   6221 static void evh__stop_client_code(ThreadId tid , ULong nDisp )
6222 {   6222 {
6223     6223  
6224     6224  
6225   {   6225   {
6226   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {   6226   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {
6227     6227  
6228   } else {   6228   } else {
6229     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",   6229     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",
6230                         (Char const   *)"hg_main.c", 1338,   6230                         (Char const   *)"hg_main.c", 1338,
6231                         (Char const   *)"evh__stop_client_code", "");   6231                         (Char const   *)"evh__stop_client_code", "");
6232   }   6232   }
6233   current_Thread = (Thread *)((void *)0);   6233   current_Thread = (Thread *)((void *)0);
6234   libhb_maybe_GC();   6234   libhb_maybe_GC();
6235   return;   6235   return;
6236 }   6236 }
6237 }   6237 }
6238 __inline static Thread *get_current_Thread_in_C_C(void)   6238 __inline static Thread *get_current_Thread_in_C_C(void)
6239 {   6239 {
6240     6240  
6241     6241  
6242   {   6242   {
6243   return (current_Thread);   6243   return (current_Thread);
6244 }   6244 }
6245 }   6245 }
6246 __inline static Thread *get_current_Thread(void)   6246 __inline static Thread *get_current_Thread(void)
6247 {   6247 {
6248   ThreadId coretid ;   6248   ThreadId coretid ;
6249   Thread *thr ;   6249   Thread *thr ;
6250   long tmp ;   6250   long tmp ;
6251     6251  
6252   {   6252   {
6253   thr = get_current_Thread_in_C_C();   6253   thr = get_current_Thread_in_C_C();
6254   tmp = __builtin_expect((long )(! (! thr)), 1L);   6254   tmp = __builtin_expect((long )(! (! thr)), 1L);
6255   if (tmp) {   6255   if (tmp) {
6256     return (thr);   6256     return (thr);
6257   } else {   6257   } else {
6258     6258  
6259   }   6259   }
6260   coretid = vgPlain_get_running_tid();   6260   coretid = vgPlain_get_running_tid();
6261   if (coretid == 0U) {   6261   if (coretid == 0U) {
6262     coretid = (ThreadId )1;   6262     coretid = (ThreadId )1;
6263   } else {   6263   } else {
6264     6264  
6265   }   6265   }
6266   thr = map_threads_lookup(coretid);   6266   thr = map_threads_lookup(coretid);
6267   return (thr);   6267   return (thr);
6268 }   6268 }
6269 }   6269 }
6270 static void evh__new_mem(Addr a , SizeT len )   6270 static void evh__new_mem(Addr a , SizeT len )
6271 {   6271 {
6272   Thread *tmp ;   6272   Thread *tmp ;
6273     6273  
6274   {   6274   {
6275   tmp = get_current_Thread();   6275   tmp = get_current_Thread();
6276   shadow_mem_make_New(tmp, a, len);   6276   shadow_mem_make_New(tmp, a, len);
6277   if (len >= 256UL) {   6277   if (len >= 256UL) {
6278     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6278     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6279       all__sanity_check((Char *)"evh__new_mem-post");   6279       all__sanity_check((Char *)"evh__new_mem-post");
6280     } else {   6280     } else {
6281     6281  
6282     }   6282     }
6283   } else {   6283   } else {
6284     6284  
6285   }   6285   }
6286   return;   6286   return;
6287 }   6287 }
6288 }   6288 }
6289 static void evh__new_mem_stack(Addr a , SizeT len )   6289 static void evh__new_mem_stack(Addr a , SizeT len )
6290 {   6290 {
6291   Thread *tmp ;   6291   Thread *tmp ;
6292     6292  
6293   {   6293   {
6294   tmp = get_current_Thread();   6294   tmp = get_current_Thread();
6295   shadow_mem_make_New(tmp, a, len);   6295   shadow_mem_make_New(tmp, a, len);
6296   if (len >= 256UL) {   6296   if (len >= 256UL) {
6297     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6297     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6298       all__sanity_check((Char *)"evh__new_mem_stack-post");   6298       all__sanity_check((Char *)"evh__new_mem_stack-post");
6299     } else {   6299     } else {
6300     6300  
6301     }   6301     }
6302   } else {   6302   } else {
6303     6303  
6304   }   6304   }
6305   return;   6305   return;
6306 }   6306 }
6307 }   6307 }
6308 static void evh__new_mem_w_tid(Addr a , SizeT len , ThreadId tid )   6308 static void evh__new_mem_w_tid(Addr a , SizeT len , ThreadId tid )
6309 {   6309 {
6310   Thread *tmp ;   6310   Thread *tmp ;
6311     6311  
6312   {   6312   {
6313   tmp = get_current_Thread();   6313   tmp = get_current_Thread();
6314   shadow_mem_make_New(tmp, a, len);   6314   shadow_mem_make_New(tmp, a, len);
6315   if (len >= 256UL) {   6315   if (len >= 256UL) {
6316     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6316     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6317       all__sanity_check((Char *)"evh__new_mem_w_tid-post");   6317       all__sanity_check((Char *)"evh__new_mem_w_tid-post");
6318     } else {   6318     } else {
6319     6319  
6320     }   6320     }
6321   } else {   6321   } else {
6322     6322  
6323   }   6323   }
6324   return;   6324   return;
6325 }   6325 }
6326 }   6326 }
6327 static void evh__new_mem_w_perms(Addr a , SizeT len , Bool rr , Bool ww ,   6327 static void evh__new_mem_w_perms(Addr a , SizeT len , Bool rr , Bool ww ,
6328                                  Bool xx , ULong di_handle )   6328                                  Bool xx , ULong di_handle )
6329 {   6329 {
6330   Thread *tmp ;   6330   Thread *tmp ;
6331     6331  
6332   {   6332   {
6333   if (rr) {   6333   if (rr) {
6334     tmp = get_current_Thread();   6334     tmp = get_current_Thread();
6335     shadow_mem_make_New(tmp, a, len);   6335     shadow_mem_make_New(tmp, a, len);
6336   } else   6336   } else
6337   if (ww) {   6337   if (ww) {
6338     tmp = get_current_Thread();   6338     tmp = get_current_Thread();
6339     shadow_mem_make_New(tmp, a, len);   6339     shadow_mem_make_New(tmp, a, len);
6340   } else   6340   } else
6341   if (xx) {   6341   if (xx) {
6342     tmp = get_current_Thread();   6342     tmp = get_current_Thread();
6343     shadow_mem_make_New(tmp, a, len);   6343     shadow_mem_make_New(tmp, a, len);
6344   } else {   6344   } else {
6345     6345  
6346   }   6346   }
6347   if (len >= 256UL) {   6347   if (len >= 256UL) {
6348     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6348     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6349       all__sanity_check((Char *)"evh__new_mem_w_perms-post");   6349       all__sanity_check((Char *)"evh__new_mem_w_perms-post");
6350     } else {   6350     } else {
6351     6351  
6352     }   6352     }
6353   } else {   6353   } else {
6354     6354  
6355   }   6355   }
6356   return;   6356   return;
6357 }   6357 }
6358 }   6358 }
6359 static void evh__set_perms(Addr a , SizeT len , Bool rr , Bool ww , Bool xx )   6359 static void evh__set_perms(Addr a , SizeT len , Bool rr , Bool ww , Bool xx )
6360 {   6360 {
6361   Thread *tmp ;   6361   Thread *tmp ;
6362     6362  
6363   {   6363   {
6364   if (rr) {   6364   if (rr) {
6365     6365  
6366   } else   6366   } else
6367   if (ww) {   6367   if (ww) {
6368     6368  
6369   } else {   6369   } else {
6370     tmp = get_current_Thread();   6370     tmp = get_current_Thread();
6371     shadow_mem_make_NoAccess(tmp, a, len);   6371     shadow_mem_make_NoAccess(tmp, a, len);
6372   }   6372   }
6373   if (len >= 256UL) {   6373   if (len >= 256UL) {
6374     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6374     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6375       all__sanity_check((Char *)"evh__set_perms-post");   6375       all__sanity_check((Char *)"evh__set_perms-post");
6376     } else {   6376     } else {
6377     6377  
6378     }   6378     }
6379   } else {   6379   } else {
6380     6380  
6381   }   6381   }
6382   return;   6382   return;
6383 }   6383 }
6384 }   6384 }
6385 static void evh__die_mem(Addr a , SizeT len )   6385 static void evh__die_mem(Addr a , SizeT len )
6386 {   6386 {
6387   Thread *tmp ;   6387   Thread *tmp ;
6388     6388  
6389   {   6389   {
6390   tmp = get_current_Thread();   6390   tmp = get_current_Thread();
6391   shadow_mem_make_NoAccess(tmp, a, len);   6391   shadow_mem_make_NoAccess(tmp, a, len);
6392   if (len >= 256UL) {   6392   if (len >= 256UL) {
6393     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6393     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6394       all__sanity_check((Char *)"evh__die_mem-post");   6394       all__sanity_check((Char *)"evh__die_mem-post");
6395     } else {   6395     } else {
6396     6396  
6397     }   6397     }
6398   } else {   6398   } else {
6399     6399  
6400   }   6400   }
6401   return;   6401   return;
6402 }   6402 }
6403 }   6403 }
6404 static void evh__untrack_mem(Addr a , SizeT len )   6404 static void evh__untrack_mem(Addr a , SizeT len )
6405 {   6405 {
6406   Thread *tmp ;   6406   Thread *tmp ;
6407     6407  
6408   {   6408   {
6409   tmp = get_current_Thread();   6409   tmp = get_current_Thread();
6410   shadow_mem_make_Untracked(tmp, a, len);   6410   shadow_mem_make_Untracked(tmp, a, len);
6411   if (len >= 256UL) {   6411   if (len >= 256UL) {
6412     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6412     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6413       all__sanity_check((Char *)"evh__untrack_mem-post");   6413       all__sanity_check((Char *)"evh__untrack_mem-post");
6414     } else {   6414     } else {
6415     6415  
6416     }   6416     }
6417   } else {   6417   } else {
6418     6418  
6419   }   6419   }
6420   return;   6420   return;
6421 }   6421 }
6422 }   6422 }
6423 static void evh__copy_mem(Addr src , Addr dst , SizeT len )   6423 static void evh__copy_mem(Addr src , Addr dst , SizeT len )
6424 {   6424 {
6425   Thread *tmp ;   6425   Thread *tmp ;
6426     6426  
6427   {   6427   {
6428   tmp = get_current_Thread();   6428   tmp = get_current_Thread();
6429   shadow_mem_scopy_range(tmp, src, dst, len);   6429   shadow_mem_scopy_range(tmp, src, dst, len);
6430   if (len >= 256UL) {   6430   if (len >= 256UL) {
6431     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6431     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6432       all__sanity_check((Char *)"evh__copy_mem-post");   6432       all__sanity_check((Char *)"evh__copy_mem-post");
6433     } else {   6433     } else {
6434     6434  
6435     }   6435     }
6436   } else {   6436   } else {
6437     6437  
6438   }   6438   }
6439   return;   6439   return;
6440 }   6440 }
6441 }   6441 }
6442 static void evh__pre_thread_ll_create(ThreadId parent , ThreadId child )   6442 static void evh__pre_thread_ll_create(ThreadId parent , ThreadId child )
6443 {   6443 {
6444   Thread *thr_p ;   6444   Thread *thr_p ;
6445   Thread *thr_c ;   6445   Thread *thr_c ;
6446   Thr *hbthr_p ;   6446   Thr *hbthr_p ;
6447   Thr *hbthr_c ;   6447   Thr *hbthr_c ;
6448   Bool tmp ;   6448   Bool tmp ;
6449   Bool tmp___0 ;   6449   Bool tmp___0 ;
6450   void *tmp___1 ;   6450   void *tmp___1 ;
6451   void *tmp___2 ;   6451   void *tmp___2 ;
6452   Word first_ip_delta ;   6452   Word first_ip_delta ;
6453     6453  
6454   {   6454   {
6455   if (parent != 0U) {   6455   if (parent != 0U) {
6456     tmp = vgHelgrind_is_sane_ThreadId(parent);   6456     tmp = vgHelgrind_is_sane_ThreadId(parent);
6457     if (tmp) {   6457     if (tmp) {
6458     6458  
6459     } else {   6459     } else {
6460       vgPlain_assert_fail((Bool )0,   6460       vgPlain_assert_fail((Bool )0,
6461                           (Char const   *)"HG_(is_sane_ThreadId)(parent)",   6461                           (Char const   *)"HG_(is_sane_ThreadId)(parent)",
6462                           (Char const   *)"hg_main.c", 1460,   6462                           (Char const   *)"hg_main.c", 1460,
6463                           (Char const   *)"evh__pre_thread_ll_create", "");   6463                           (Char const   *)"evh__pre_thread_ll_create", "");
6464     }   6464     }
6465     tmp___0 = vgHelgrind_is_sane_ThreadId(child);   6465     tmp___0 = vgHelgrind_is_sane_ThreadId(child);
6466     if (tmp___0) {   6466     if (tmp___0) {
6467     6467  
6468     } else {   6468     } else {
6469       vgPlain_assert_fail((Bool )0,   6469       vgPlain_assert_fail((Bool )0,
6470                           (Char const   *)"HG_(is_sane_ThreadId)(child)",   6470                           (Char const   *)"HG_(is_sane_ThreadId)(child)",
6471                           (Char const   *)"hg_main.c", 1461,   6471                           (Char const   *)"hg_main.c", 1461,
6472                           (Char const   *)"evh__pre_thread_ll_create", "");   6472                           (Char const   *)"evh__pre_thread_ll_create", "");
6473     }   6473     }
6474     if (parent != child) {   6474     if (parent != child) {
6475     6475  
6476     } else {   6476     } else {
6477       vgPlain_assert_fail((Bool )0, (Char const   *)"parent != child",   6477       vgPlain_assert_fail((Bool )0, (Char const   *)"parent != child",
6478                           (Char const   *)"hg_main.c", 1462,   6478                           (Char const   *)"hg_main.c", 1462,
6479                           (Char const   *)"evh__pre_thread_ll_create", "");   6479                           (Char const   *)"evh__pre_thread_ll_create", "");
6480     }   6480     }
6481     thr_p = map_threads_maybe_lookup(parent);   6481     thr_p = map_threads_maybe_lookup(parent);
6482     thr_c = map_threads_maybe_lookup(child);   6482     thr_c = map_threads_maybe_lookup(child);
6483     if ((unsigned int )thr_p != (unsigned int )((void *)0)) {   6483     if ((unsigned int )thr_p != (unsigned int )((void *)0)) {
6484     6484  
6485     } else {   6485     } else {
6486       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_p != NULL",   6486       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_p != NULL",
6487                           (Char const   *)"hg_main.c", 1467,   6487                           (Char const   *)"hg_main.c", 1467,
6488                           (Char const   *)"evh__pre_thread_ll_create", "");   6488                           (Char const   *)"evh__pre_thread_ll_create", "");
6489     }   6489     }
6490     if ((unsigned int )thr_c == (unsigned int )((void *)0)) {   6490     if ((unsigned int )thr_c == (unsigned int )((void *)0)) {
6491     6491  
6492     } else {   6492     } else {
6493       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_c == NULL",   6493       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_c == NULL",
6494                           (Char const   *)"hg_main.c", 1468,   6494                           (Char const   *)"hg_main.c", 1468,
6495                           (Char const   *)"evh__pre_thread_ll_create", "");   6495                           (Char const   *)"evh__pre_thread_ll_create", "");
6496     }   6496     }
6497     hbthr_p = thr_p->hbthr;   6497     hbthr_p = thr_p->hbthr;
6498     if ((unsigned int )hbthr_p != (unsigned int )((void *)0)) {   6498     if ((unsigned int )hbthr_p != (unsigned int )((void *)0)) {
6499     6499  
6500     } else {   6500     } else {
6501       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_p != NULL",   6501       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_p != NULL",
6502                           (Char const   *)"hg_main.c", 1471,   6502                           (Char const   *)"hg_main.c", 1471,
6503                           (Char const   *)"evh__pre_thread_ll_create", "");   6503                           (Char const   *)"evh__pre_thread_ll_create", "");
6504     }   6504     }
6505     tmp___1 = libhb_get_Thr_hgthread(hbthr_p);   6505     tmp___1 = libhb_get_Thr_hgthread(hbthr_p);
6506     if ((unsigned int )tmp___1 == (unsigned int )thr_p) {   6506     if ((unsigned int )tmp___1 == (unsigned int )thr_p) {
6507     6507  
6508     } else {   6508     } else {
6509       vgPlain_assert_fail((Bool )0,   6509       vgPlain_assert_fail((Bool )0,
6510                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_p) == thr_p",   6510                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_p) == thr_p",
6511                           (Char const   *)"hg_main.c", 1472,   6511                           (Char const   *)"hg_main.c", 1472,
6512                           (Char const   *)"evh__pre_thread_ll_create", "");   6512                           (Char const   *)"evh__pre_thread_ll_create", "");
6513     }   6513     }
6514     hbthr_c = libhb_create(hbthr_p);   6514     hbthr_c = libhb_create(hbthr_p);
6515     thr_c = mk_Thread(hbthr_c);   6515     thr_c = mk_Thread(hbthr_c);
6516     tmp___2 = libhb_get_Thr_hgthread(hbthr_c);   6516     tmp___2 = libhb_get_Thr_hgthread(hbthr_c);
6517     if ((unsigned int )tmp___2 == (unsigned int )((void *)0)) {   6517     if ((unsigned int )tmp___2 == (unsigned int )((void *)0)) {
6518     6518  
6519     } else {   6519     } else {
6520       vgPlain_assert_fail((Bool )0,   6520       vgPlain_assert_fail((Bool )0,
6521                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_c) == NULL",   6521                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_c) == NULL",
6522                           (Char const   *)"hg_main.c", 1479,   6522                           (Char const   *)"hg_main.c", 1479,
6523                           (Char const   *)"evh__pre_thread_ll_create", "");   6523                           (Char const   *)"evh__pre_thread_ll_create", "");
6524     }   6524     }
6525     libhb_set_Thr_hgthread(hbthr_c, (void *)thr_c);   6525     libhb_set_Thr_hgthread(hbthr_c, (void *)thr_c);
6526     *(map_threads + child) = thr_c;   6526     *(map_threads + child) = thr_c;
6527     if (thr_c->coretid == 0U) {   6527     if (thr_c->coretid == 0U) {
6528     6528  
6529     } else {   6529     } else {
6530       vgPlain_assert_fail((Bool )0,   6530       vgPlain_assert_fail((Bool )0,
6531                           (Char const   *)"thr_c->coretid == VG_INVALID_THREADID",   6531                           (Char const   *)"thr_c->coretid == VG_INVALID_THREADID",
6532                           (Char const   *)"hg_main.c", 1484,   6532                           (Char const   *)"hg_main.c", 1484,
6533                           (Char const   *)"evh__pre_thread_ll_create", "");   6533                           (Char const   *)"evh__pre_thread_ll_create", "");
6534     }   6534     }
6535     thr_c->coretid = child;   6535     thr_c->coretid = child;
6536     first_ip_delta = (Word )0;   6536     first_ip_delta = (Word )0;
6537     thr_c->created_at = vgPlain_record_ExeContext(parent, first_ip_delta);   6537     thr_c->created_at = vgPlain_record_ExeContext(parent, first_ip_delta);
6538   } else {   6538   } else {
6539     6539  
6540   }   6540   }
6541   if (vgHelgrind_clo_sanity_flags & 1L) {   6541   if (vgHelgrind_clo_sanity_flags & 1L) {
6542     all__sanity_check((Char *)"evh__pre_thread_create-post");   6542     all__sanity_check((Char *)"evh__pre_thread_create-post");
6543   } else {   6543   } else {
6544     6544  
6545   }   6545   }
6546   return;   6546   return;
6547 }   6547 }
6548 }   6548 }
6549 static void evh__pre_thread_ll_exit(ThreadId quit_tid )   6549 static void evh__pre_thread_ll_exit(ThreadId quit_tid )
6550 {   6550 {
6551   Int nHeld ;   6551   Int nHeld ;
6552   Thread *thr_q ;   6552   Thread *thr_q ;
6553   Bool tmp ;   6553   Bool tmp ;
6554   UWord tmp___0 ;   6554   UWord tmp___0 ;
6555   HChar buf[80] ;   6555   HChar buf[80] ;
6556   char const   *tmp___1 ;   6556   char const   *tmp___1 ;
6557     6557  
6558   {   6558   {
6559   tmp = vgHelgrind_is_sane_ThreadId(quit_tid);   6559   tmp = vgHelgrind_is_sane_ThreadId(quit_tid);
6560   if (tmp) {   6560   if (tmp) {
6561     6561  
6562   } else {   6562   } else {
6563     vgPlain_assert_fail((Bool )0,   6563     vgPlain_assert_fail((Bool )0,
6564                         (Char const   *)"HG_(is_sane_ThreadId)(quit_tid)",   6564                         (Char const   *)"HG_(is_sane_ThreadId)(quit_tid)",
6565                         (Char const   *)"hg_main.c", 1533,   6565                         (Char const   *)"hg_main.c", 1533,
6566                         (Char const   *)"evh__pre_thread_ll_exit", "");   6566                         (Char const   *)"evh__pre_thread_ll_exit", "");
6567   }   6567   }
6568   thr_q = map_threads_maybe_lookup(quit_tid);   6568   thr_q = map_threads_maybe_lookup(quit_tid);
6569   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {   6569   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {
6570     6570  
6571   } else {   6571   } else {
6572     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",   6572     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",
6573                         (Char const   *)"hg_main.c", 1535,   6573                         (Char const   *)"hg_main.c", 1535,
6574                         (Char const   *)"evh__pre_thread_ll_exit", "");   6574                         (Char const   *)"evh__pre_thread_ll_exit", "");
6575   }   6575   }
6576   tmp___0 = vgHelgrind_cardinalityWS(univ_lsets, thr_q->locksetA);   6576   tmp___0 = vgHelgrind_cardinalityWS(univ_lsets, thr_q->locksetA);
6577   nHeld = (Int )tmp___0;   6577   nHeld = (Int )tmp___0;
6578   if (nHeld >= 0) {   6578   if (nHeld >= 0) {
6579     6579  
6580   } else {   6580   } else {
6581     vgPlain_assert_fail((Bool )0, (Char const   *)"nHeld >= 0",   6581     vgPlain_assert_fail((Bool )0, (Char const   *)"nHeld >= 0",
6582                         (Char const   *)"hg_main.c", 1539,   6582                         (Char const   *)"hg_main.c", 1539,
6583                         (Char const   *)"evh__pre_thread_ll_exit", "");   6583                         (Char const   *)"evh__pre_thread_ll_exit", "");
6584   }   6584   }
6585   if (nHeld > 0) {   6585   if (nHeld > 0) {
6586     if (nHeld > 1) {   6586     if (nHeld > 1) {
6587       tmp___1 = "s";   6587       tmp___1 = "s";
6588     } else {   6588     } else {
6589       tmp___1 = "";   6589       tmp___1 = "";
6590     }   6590     }
6591     vgPlain_sprintf((Char *)(buf), "Exiting thread still holds %d lock%s",   6591     vgPlain_sprintf((Char *)(buf), "Exiting thread still holds %d lock%s",
6592                     nHeld, tmp___1);   6592                     nHeld, tmp___1);
6593     vgHelgrind_record_error_Misc(thr_q, buf);   6593     vgHelgrind_record_error_Misc(thr_q, buf);
6594   } else {   6594   } else {
6595     6595  
6596   }   6596   }
6597   if (thr_q->hbthr) {   6597   if (thr_q->hbthr) {
6598     6598  
6599   } else {   6599   } else {
6600     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->hbthr",   6600     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->hbthr",
6601                         (Char const   *)"hg_main.c", 1553,   6601                         (Char const   *)"hg_main.c", 1553,
6602                         (Char const   *)"evh__pre_thread_ll_exit", "");   6602                         (Char const   *)"evh__pre_thread_ll_exit", "");
6603   }   6603   }
6604   libhb_async_exit(thr_q->hbthr);   6604   libhb_async_exit(thr_q->hbthr);
6605   if (thr_q->coretid == quit_tid) {   6605   if (thr_q->coretid == quit_tid) {
6606     6606  
6607   } else {   6607   } else {
6608     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->coretid == quit_tid",   6608     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->coretid == quit_tid",
6609                         (Char const   *)"hg_main.c", 1555,   6609                         (Char const   *)"hg_main.c", 1555,
6610                         (Char const   *)"evh__pre_thread_ll_exit", "");   6610                         (Char const   *)"evh__pre_thread_ll_exit", "");
6611   }   6611   }
6612   thr_q->coretid = (ThreadId )0;   6612   thr_q->coretid = (ThreadId )0;
6613   map_threads_delete(quit_tid);   6613   map_threads_delete(quit_tid);
6614   if (vgHelgrind_clo_sanity_flags & 1L) {   6614   if (vgHelgrind_clo_sanity_flags & 1L) {
6615     all__sanity_check((Char *)"evh__pre_thread_ll_exit-post");   6615     all__sanity_check((Char *)"evh__pre_thread_ll_exit-post");
6616   } else {   6616   } else {
6617     6617  
6618   }   6618   }
6619   return;   6619   return;
6620 }   6620 }
6621 }   6621 }
6622 static void evh__atfork_child(ThreadId tid )   6622 static void evh__atfork_child(ThreadId tid )
6623 {   6623 {
6624   UInt i ;   6624   UInt i ;
6625   Thread *thr ;   6625   Thread *thr ;
6626     6626  
6627   {   6627   {
6628   thr = map_threads_maybe_lookup((ThreadId )0);   6628   thr = map_threads_maybe_lookup((ThreadId )0);
6629   if (! thr) {   6629   if (! thr) {
6630     6630  
6631   } else {   6631   } else {
6632     vgPlain_assert_fail((Bool )0, (Char const   *)"!thr",   6632     vgPlain_assert_fail((Bool )0, (Char const   *)"!thr",
6633                         (Char const   *)"hg_main.c", 1574,   6633                         (Char const   *)"hg_main.c", 1574,
6634                         (Char const   *)"evh__atfork_child", "");   6634                         (Char const   *)"evh__atfork_child", "");
6635   }   6635   }
6636   i = (UInt )1;   6636   i = (UInt )1;
6637   while (i < 500U) {   6637   while (i < 500U) {
6638     if (i == tid) {   6638     if (i == tid) {
6639       goto __Cont;   6639       goto __Cont;
6640     } else {   6640     } else {
6641     6641  
6642     }   6642     }
6643     thr = map_threads_maybe_lookup(i);   6643     thr = map_threads_maybe_lookup(i);
6644     if (! thr) {   6644     if (! thr) {
6645       goto __Cont;   6645       goto __Cont;
6646     } else {   6646     } else {
6647     6647  
6648     }   6648     }
6649     if (thr->hbthr) {   6649     if (thr->hbthr) {
6650     6650  
6651     } else {   6651     } else {
6652       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   6652       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
6653                           (Char const   *)"hg_main.c", 1584,   6653                           (Char const   *)"hg_main.c", 1584,
6654                           (Char const   *)"evh__atfork_child", "");   6654                           (Char const   *)"evh__atfork_child", "");
6655     }   6655     }
6656     libhb_async_exit(thr->hbthr);   6656     libhb_async_exit(thr->hbthr);
6657     if (thr->coretid == i) {   6657     if (thr->coretid == i) {
6658     6658  
6659     } else {   6659     } else {
6660       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->coretid == i",   6660       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->coretid == i",
6661                           (Char const   *)"hg_main.c", 1586,   6661                           (Char const   *)"hg_main.c", 1586,
6662                           (Char const   *)"evh__atfork_child", "");   6662                           (Char const   *)"evh__atfork_child", "");
6663     }   6663     }
6664     thr->coretid = (ThreadId )0;   6664     thr->coretid = (ThreadId )0;
6665     map_threads_delete(i);   6665     map_threads_delete(i);
6666     __Cont: /* CIL Label */   6666     __Cont: /* CIL Label */
6667     i ++;   6667     i ++;
6668   }   6668   }
6669   return;   6669   return;
6670 }   6670 }
6671 }   6671 }
6672 static void evh__HG_PTHREAD_JOIN_POST(ThreadId stay_tid , Thread *quit_thr )   6672 static void evh__HG_PTHREAD_JOIN_POST(ThreadId stay_tid , Thread *quit_thr )
6673 {   6673 {
6674   Thread *thr_s ;   6674   Thread *thr_s ;
6675   Thread *thr_q ;   6675   Thread *thr_q ;
6676   Thr *hbthr_s ;   6676   Thr *hbthr_s ;
6677   Thr *hbthr_q ;   6677   Thr *hbthr_q ;
6678   SO *so ;   6678   SO *so ;
6679   Bool tmp ;   6679   Bool tmp ;
6680   void *tmp___0 ;   6680   void *tmp___0 ;
6681   void *tmp___1 ;   6681   void *tmp___1 ;
6682   ThreadId tmp___2 ;   6682   ThreadId tmp___2 ;
6683     6683  
6684   {   6684   {
6685   tmp = vgHelgrind_is_sane_ThreadId(stay_tid);   6685   tmp = vgHelgrind_is_sane_ThreadId(stay_tid);
6686   if (tmp) {   6686   if (tmp) {
6687     6687  
6688   } else {   6688   } else {
6689     vgPlain_assert_fail((Bool )0,   6689     vgPlain_assert_fail((Bool )0,
6690                         (Char const   *)"HG_(is_sane_ThreadId)(stay_tid)",   6690                         (Char const   *)"HG_(is_sane_ThreadId)(stay_tid)",
6691                         (Char const   *)"hg_main.c", 1606,   6691                         (Char const   *)"hg_main.c", 1606,
6692                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6692                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6693   }   6693   }
6694   thr_s = map_threads_maybe_lookup(stay_tid);   6694   thr_s = map_threads_maybe_lookup(stay_tid);
6695   thr_q = quit_thr;   6695   thr_q = quit_thr;
6696   if ((unsigned int )thr_s != (unsigned int )((void *)0)) {   6696   if ((unsigned int )thr_s != (unsigned int )((void *)0)) {
6697     6697  
6698   } else {   6698   } else {
6699     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != NULL",   6699     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != NULL",
6700                         (Char const   *)"hg_main.c", 1610,   6700                         (Char const   *)"hg_main.c", 1610,
6701                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6701                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6702   }   6702   }
6703   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {   6703   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {
6704     6704  
6705   } else {   6705   } else {
6706     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",   6706     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",
6707                         (Char const   *)"hg_main.c", 1611,   6707                         (Char const   *)"hg_main.c", 1611,
6708                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6708                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6709   }   6709   }
6710   if ((unsigned int )thr_s != (unsigned int )thr_q) {   6710   if ((unsigned int )thr_s != (unsigned int )thr_q) {
6711     6711  
6712   } else {   6712   } else {
6713     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != thr_q",   6713     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != thr_q",
6714                         (Char const   *)"hg_main.c", 1612,   6714                         (Char const   *)"hg_main.c", 1612,
6715                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6715                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6716   }   6716   }
6717   hbthr_s = thr_s->hbthr;   6717   hbthr_s = thr_s->hbthr;
6718   hbthr_q = thr_q->hbthr;   6718   hbthr_q = thr_q->hbthr;
6719   if ((unsigned int )hbthr_s != (unsigned int )hbthr_q) {   6719   if ((unsigned int )hbthr_s != (unsigned int )hbthr_q) {
6720     6720  
6721   } else {   6721   } else {
6722     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_s != hbthr_q",   6722     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_s != hbthr_q",
6723                         (Char const   *)"hg_main.c", 1616,   6723                         (Char const   *)"hg_main.c", 1616,
6724                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6724                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6725   }   6725   }
6726   tmp___0 = libhb_get_Thr_hgthread(hbthr_s);   6726   tmp___0 = libhb_get_Thr_hgthread(hbthr_s);
6727   if ((unsigned int )tmp___0 == (unsigned int )thr_s) {   6727   if ((unsigned int )tmp___0 == (unsigned int )thr_s) {
6728     6728  
6729   } else {   6729   } else {
6730     vgPlain_assert_fail((Bool )0,   6730     vgPlain_assert_fail((Bool )0,
6731                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_s) == thr_s",   6731                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_s) == thr_s",
6732                         (Char const   *)"hg_main.c", 1617,   6732                         (Char const   *)"hg_main.c", 1617,
6733                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6733                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6734   }   6734   }
6735   tmp___1 = libhb_get_Thr_hgthread(hbthr_q);   6735   tmp___1 = libhb_get_Thr_hgthread(hbthr_q);
6736   if ((unsigned int )tmp___1 == (unsigned int )thr_q) {   6736   if ((unsigned int )tmp___1 == (unsigned int )thr_q) {
6737     6737  
6738   } else {   6738   } else {
6739     vgPlain_assert_fail((Bool )0,   6739     vgPlain_assert_fail((Bool )0,
6740                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_q) == thr_q",   6740                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_q) == thr_q",
6741                         (Char const   *)"hg_main.c", 1618,   6741                         (Char const   *)"hg_main.c", 1618,
6742                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6742                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6743   }   6743   }
6744   so = libhb_so_alloc();   6744   so = libhb_so_alloc();
6745   if (so) {   6745   if (so) {
6746     6746  
6747   } else {   6747   } else {
6748     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   6748     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
6749                         (Char const   *)"hg_main.c", 1625,   6749                         (Char const   *)"hg_main.c", 1625,
6750                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6750                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6751   }   6751   }
6752   libhb_so_send(hbthr_q, so, (Bool )1);   6752   libhb_so_send(hbthr_q, so, (Bool )1);
6753   libhb_so_recv(hbthr_s, so, (Bool )1);   6753   libhb_so_recv(hbthr_s, so, (Bool )1);
6754   libhb_so_dealloc(so);   6754   libhb_so_dealloc(so);
6755   tmp___2 = map_threads_maybe_reverse_lookup_SLOW(thr_q);   6755   tmp___2 = map_threads_maybe_reverse_lookup_SLOW(thr_q);
6756   if (tmp___2 == 0U) {   6756   if (tmp___2 == 0U) {
6757     6757  
6758   } else {   6758   } else {
6759     vgPlain_assert_fail((Bool )0,   6759     vgPlain_assert_fail((Bool )0,
6760                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW(thr_q) == VG_INVALID_THREADID",   6760                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW(thr_q) == VG_INVALID_THREADID",
6761                         (Char const   *)"hg_main.c", 1643,   6761                         (Char const   *)"hg_main.c", 1643,
6762                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6762                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6763   }   6763   }
6764   if (vgHelgrind_clo_sanity_flags & 1L) {   6764   if (vgHelgrind_clo_sanity_flags & 1L) {
6765     all__sanity_check((Char *)"evh__post_thread_join-post");   6765     all__sanity_check((Char *)"evh__post_thread_join-post");
6766   } else {   6766   } else {
6767     6767  
6768   }   6768   }
6769   return;   6769   return;
6770 }   6770 }
6771 }   6771 }
6772 static void evh__pre_mem_read(CorePart part , ThreadId tid , Char *s , Addr a ,   6772 static void evh__pre_mem_read(CorePart part , ThreadId tid , Char *s , Addr a ,
6773                               SizeT size )   6773                               SizeT size )
6774 {   6774 {
6775   Thread *tmp ;   6775   Thread *tmp ;
6776     6776  
6777   {   6777   {
6778   tmp = map_threads_lookup(tid);   6778   tmp = map_threads_lookup(tid);
6779   shadow_mem_cread_range(tmp, a, size);   6779   shadow_mem_cread_range(tmp, a, size);
6780   if (size >= 256UL) {   6780   if (size >= 256UL) {
6781     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6781     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6782       all__sanity_check((Char *)"evh__pre_mem_read-post");   6782       all__sanity_check((Char *)"evh__pre_mem_read-post");
6783     } else {   6783     } else {
6784     6784  
6785     }   6785     }
6786   } else {   6786   } else {
6787     6787  
6788   }   6788   }
6789   return;   6789   return;
6790 }   6790 }
6791 }   6791 }
6792 static void evh__pre_mem_read_asciiz(CorePart part , ThreadId tid , Char *s ,   6792 static void evh__pre_mem_read_asciiz(CorePart part , ThreadId tid , Char *s ,
6793                                      Addr a )   6793                                      Addr a )
6794 {   6794 {
6795   Int len ;   6795   Int len ;
6796   Bool tmp ;   6796   Bool tmp ;
6797   SizeT tmp___0 ;   6797   SizeT tmp___0 ;
6798   Thread *tmp___1 ;   6798   Thread *tmp___1 ;
6799     6799  
6800   {   6800   {
6801   tmp = vgPlain_am_is_valid_for_client(a, (SizeT )1, (UInt )1);   6801   tmp = vgPlain_am_is_valid_for_client(a, (SizeT )1, (UInt )1);
6802   if (tmp) {   6802   if (tmp) {
6803     6803  
6804   } else {   6804   } else {
6805     return;   6805     return;
6806   }   6806   }
6807   tmp___0 = vgPlain_strlen((Char const   *)((Char *)a));   6807   tmp___0 = vgPlain_strlen((Char const   *)((Char *)a));
6808   len = (Int )tmp___0;   6808   len = (Int )tmp___0;
6809   tmp___1 = map_threads_lookup(tid);   6809   tmp___1 = map_threads_lookup(tid);
6810   shadow_mem_cread_range(tmp___1, a, (SizeT )(len + 1));   6810   shadow_mem_cread_range(tmp___1, a, (SizeT )(len + 1));
6811   if (len >= 256) {   6811   if (len >= 256) {
6812     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6812     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6813       all__sanity_check((Char *)"evh__pre_mem_read_asciiz-post");   6813       all__sanity_check((Char *)"evh__pre_mem_read_asciiz-post");
6814     } else {   6814     } else {
6815     6815  
6816     }   6816     }
6817   } else {   6817   } else {
6818     6818  
6819   }   6819   }
6820   return;   6820   return;
6821 }   6821 }
6822 }   6822 }
6823 static void evh__pre_mem_write(CorePart part , ThreadId tid , Char *s , Addr a ,   6823 static void evh__pre_mem_write(CorePart part , ThreadId tid , Char *s , Addr a ,
6824                                SizeT size )   6824                                SizeT size )
6825 {   6825 {
6826   Thread *tmp ;   6826   Thread *tmp ;
6827     6827  
6828   {   6828   {
6829   tmp = map_threads_lookup(tid);   6829   tmp = map_threads_lookup(tid);
6830   shadow_mem_cwrite_range(tmp, a, size);   6830   shadow_mem_cwrite_range(tmp, a, size);
6831   if (size >= 256UL) {   6831   if (size >= 256UL) {
6832     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6832     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6833       all__sanity_check((Char *)"evh__pre_mem_write-post");   6833       all__sanity_check((Char *)"evh__pre_mem_write-post");
6834     } else {   6834     } else {
6835     6835  
6836     }   6836     }
6837   } else {   6837   } else {
6838     6838  
6839   }   6839   }
6840   return;   6840   return;
6841 }   6841 }
6842 }   6842 }
6843 static void evh__new_mem_heap(Addr a , SizeT len , Bool is_inited )   6843 static void evh__new_mem_heap(Addr a , SizeT len , Bool is_inited )
6844 {   6844 {
6845   Thread *tmp ;   6845   Thread *tmp ;
6846   Thread *tmp___0 ;   6846   Thread *tmp___0 ;
6847     6847  
6848   {   6848   {
6849   if (is_inited) {   6849   if (is_inited) {
6850     tmp = get_current_Thread();   6850     tmp = get_current_Thread();
6851     shadow_mem_make_New(tmp, a, len);   6851     shadow_mem_make_New(tmp, a, len);
6852   } else {   6852   } else {
6853     tmp___0 = get_current_Thread();   6853     tmp___0 = get_current_Thread();
6854     shadow_mem_make_New(tmp___0, a, len);   6854     shadow_mem_make_New(tmp___0, a, len);
6855   }   6855   }
6856   if (len >= 256UL) {   6856   if (len >= 256UL) {
6857     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6857     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6858       all__sanity_check((Char *)"evh__pre_mem_read-post");   6858       all__sanity_check((Char *)"evh__pre_mem_read-post");
6859     } else {   6859     } else {
6860     6860  
6861     }   6861     }
6862   } else {   6862   } else {
6863     6863  
6864   }   6864   }
6865   return;   6865   return;
6866 }   6866 }
6867 }   6867 }
6868 static void evh__die_mem_heap(Addr a , SizeT len )   6868 static void evh__die_mem_heap(Addr a , SizeT len )
6869 {   6869 {
6870   Thread *tmp ;   6870   Thread *tmp ;
6871     6871  
6872   {   6872   {
6873   tmp = get_current_Thread();   6873   tmp = get_current_Thread();
6874   shadow_mem_make_NoAccess(tmp, a, len);   6874   shadow_mem_make_NoAccess(tmp, a, len);
6875   if (len >= 256UL) {   6875   if (len >= 256UL) {
6876     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6876     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6877       all__sanity_check((Char *)"evh__pre_mem_read-post");   6877       all__sanity_check((Char *)"evh__pre_mem_read-post");
6878     } else {   6878     } else {
6879     6879  
6880     }   6880     }
6881   } else {   6881   } else {
6882     6882  
6883   }   6883   }
6884   return;   6884   return;
6885 }   6885 }
6886 }   6886 }
6887 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_1)(Addr a )   6887 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_1)(Addr a )
6888 {   6888 {
6889   Thread *thr ;   6889   Thread *thr ;
6890   Thread *tmp ;   6890   Thread *tmp ;
6891   Thr *hbthr ;   6891   Thr *hbthr ;
6892     6892  
6893   {   6893   {
6894   tmp = get_current_Thread_in_C_C();   6894   tmp = get_current_Thread_in_C_C();
6895   thr = tmp;   6895   thr = tmp;
6896   hbthr = thr->hbthr;   6896   hbthr = thr->hbthr;
6897   zsm_sapply08_f__msmcread(hbthr, a);   6897   zsm_sapply08_f__msmcread(hbthr, a);
6898   return;   6898   return;
6899 }   6899 }
6900 }   6900 }
6901 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_2)(Addr a )   6901 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_2)(Addr a )
6902 {   6902 {
6903   Thread *thr ;   6903   Thread *thr ;
6904   Thread *tmp ;   6904   Thread *tmp ;
6905   Thr *hbthr ;   6905   Thr *hbthr ;
6906     6906  
6907   {   6907   {
6908   tmp = get_current_Thread_in_C_C();   6908   tmp = get_current_Thread_in_C_C();
6909   thr = tmp;   6909   thr = tmp;
6910   hbthr = thr->hbthr;   6910   hbthr = thr->hbthr;
6911   zsm_sapply16_f__msmcread(hbthr, a);   6911   zsm_sapply16_f__msmcread(hbthr, a);
6912   return;   6912   return;
6913 }   6913 }
6914 }   6914 }
6915 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_4)(Addr a )   6915 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_4)(Addr a )
6916 {   6916 {
6917   Thread *thr ;   6917   Thread *thr ;
6918   Thread *tmp ;   6918   Thread *tmp ;
6919   Thr *hbthr ;   6919   Thr *hbthr ;
6920     6920  
6921   {   6921   {
6922   tmp = get_current_Thread_in_C_C();   6922   tmp = get_current_Thread_in_C_C();
6923   thr = tmp;   6923   thr = tmp;
6924   hbthr = thr->hbthr;   6924   hbthr = thr->hbthr;
6925   zsm_sapply32_f__msmcread(hbthr, a);   6925   zsm_sapply32_f__msmcread(hbthr, a);
6926   return;   6926   return;
6927 }   6927 }
6928 }   6928 }
6929 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_8)(Addr a )   6929 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_8)(Addr a )
6930 {   6930 {
6931   Thread *thr ;   6931   Thread *thr ;
6932   Thread *tmp ;   6932   Thread *tmp ;
6933   Thr *hbthr ;   6933   Thr *hbthr ;
6934     6934  
6935   {   6935   {
6936   tmp = get_current_Thread_in_C_C();   6936   tmp = get_current_Thread_in_C_C();
6937   thr = tmp;   6937   thr = tmp;
6938   hbthr = thr->hbthr;   6938   hbthr = thr->hbthr;
6939   zsm_sapply64_f__msmcread(hbthr, a);   6939   zsm_sapply64_f__msmcread(hbthr, a);
6940   return;   6940   return;
6941 }   6941 }
6942 }   6942 }
6943 static void ( __attribute__((__regparm__(2))) evh__mem_help_cread_N)(Addr a ,   6943 static void ( __attribute__((__regparm__(2))) evh__mem_help_cread_N)(Addr a ,
6944                                                                      SizeT size )   6944                                                                      SizeT size )
6945 {   6945 {
6946   Thread *thr ;   6946   Thread *thr ;
6947   Thread *tmp ;   6947   Thread *tmp ;
6948   Thr *hbthr ;   6948   Thr *hbthr ;
6949     6949  
6950   {   6950   {
6951   tmp = get_current_Thread_in_C_C();   6951   tmp = get_current_Thread_in_C_C();
6952   thr = tmp;   6952   thr = tmp;
6953   hbthr = thr->hbthr;   6953   hbthr = thr->hbthr;
6954   zsm_sapplyNN_f__msmcread(hbthr, a, size);   6954   zsm_sapplyNN_f__msmcread(hbthr, a, size);
6955   return;   6955   return;
6956 }   6956 }
6957 }   6957 }
6958 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_1)(Addr a )   6958 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_1)(Addr a )
6959 {   6959 {
6960   Thread *thr ;   6960   Thread *thr ;
6961   Thread *tmp ;   6961   Thread *tmp ;
6962   Thr *hbthr ;   6962   Thr *hbthr ;
6963     6963  
6964   {   6964   {
6965   tmp = get_current_Thread_in_C_C();   6965   tmp = get_current_Thread_in_C_C();
6966   thr = tmp;   6966   thr = tmp;
6967   hbthr = thr->hbthr;   6967   hbthr = thr->hbthr;
6968   zsm_sapply08_f__msmcwrite(hbthr, a);   6968   zsm_sapply08_f__msmcwrite(hbthr, a);
6969   return;   6969   return;
6970 }   6970 }
6971 }   6971 }
6972 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_2)(Addr a )   6972 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_2)(Addr a )
6973 {   6973 {
6974   Thread *thr ;   6974   Thread *thr ;
6975   Thread *tmp ;   6975   Thread *tmp ;
6976   Thr *hbthr ;   6976   Thr *hbthr ;
6977     6977  
6978   {   6978   {
6979   tmp = get_current_Thread_in_C_C();   6979   tmp = get_current_Thread_in_C_C();
6980   thr = tmp;   6980   thr = tmp;
6981   hbthr = thr->hbthr;   6981   hbthr = thr->hbthr;
6982   zsm_sapply16_f__msmcwrite(hbthr, a);   6982   zsm_sapply16_f__msmcwrite(hbthr, a);
6983   return;   6983   return;
6984 }   6984 }
6985 }   6985 }
6986 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_4)(Addr a )   6986 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_4)(Addr a )
6987 {   6987 {
6988   Thread *thr ;   6988   Thread *thr ;
6989   Thread *tmp ;   6989   Thread *tmp ;
6990   Thr *hbthr ;   6990   Thr *hbthr ;
6991     6991  
6992   {   6992   {
6993   tmp = get_current_Thread_in_C_C();   6993   tmp = get_current_Thread_in_C_C();
6994   thr = tmp;   6994   thr = tmp;
6995   hbthr = thr->hbthr;   6995   hbthr = thr->hbthr;
6996   zsm_sapply32_f__msmcwrite(hbthr, a);   6996   zsm_sapply32_f__msmcwrite(hbthr, a);
6997   return;   6997   return;
6998 }   6998 }
6999 }   6999 }
7000 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_8)(Addr a )   7000 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_8)(Addr a )
7001 {   7001 {
7002   Thread *thr ;   7002   Thread *thr ;
7003   Thread *tmp ;   7003   Thread *tmp ;
7004   Thr *hbthr ;   7004   Thr *hbthr ;
7005     7005  
7006   {   7006   {
7007   tmp = get_current_Thread_in_C_C();   7007   tmp = get_current_Thread_in_C_C();
7008   thr = tmp;   7008   thr = tmp;
7009   hbthr = thr->hbthr;   7009   hbthr = thr->hbthr;
7010   zsm_sapply64_f__msmcwrite(hbthr, a);   7010   zsm_sapply64_f__msmcwrite(hbthr, a);
7011   return;   7011   return;
7012 }   7012 }
7013 }   7013 }
7014 static void ( __attribute__((__regparm__(2))) evh__mem_help_cwrite_N)(Addr a ,   7014 static void ( __attribute__((__regparm__(2))) evh__mem_help_cwrite_N)(Addr a ,
7015                                                                       SizeT size )   7015                                                                       SizeT size )
7016 {   7016 {
7017   Thread *thr ;   7017   Thread *thr ;
7018   Thread *tmp ;   7018   Thread *tmp ;
7019   Thr *hbthr ;   7019   Thr *hbthr ;
7020     7020  
7021   {   7021   {
7022   tmp = get_current_Thread_in_C_C();   7022   tmp = get_current_Thread_in_C_C();
7023   thr = tmp;   7023   thr = tmp;
7024   hbthr = thr->hbthr;   7024   hbthr = thr->hbthr;
7025   zsm_sapplyNN_f__msmcwrite(hbthr, a, size);   7025   zsm_sapplyNN_f__msmcwrite(hbthr, a, size);
7026   return;   7026   return;
7027 }   7027 }
7028 }   7028 }
7029 static void evh__HG_PTHREAD_MUTEX_INIT_POST(ThreadId tid , void *mutex ,   7029 static void evh__HG_PTHREAD_MUTEX_INIT_POST(ThreadId tid , void *mutex ,
7030                                             Word mbRec )   7030                                             Word mbRec )
7031 {   7031 {
7032   int tmp ;   7032   int tmp ;
7033     7033  
7034   {   7034   {
7035   if (mbRec == 0L) {   7035   if (mbRec == 0L) {
7036     7036  
7037   } else   7037   } else
7038   if (mbRec == 1L) {   7038   if (mbRec == 1L) {
7039     7039  
7040   } else {   7040   } else {
7041     vgPlain_assert_fail((Bool )0, (Char const   *)"mbRec == 0 || mbRec == 1",   7041     vgPlain_assert_fail((Bool )0, (Char const   *)"mbRec == 0 || mbRec == 1",
7042                         (Char const   *)"hg_main.c", 1803,   7042                         (Char const   *)"hg_main.c", 1803,
7043                         (Char const   *)"evh__HG_PTHREAD_MUTEX_INIT_POST", "");   7043                         (Char const   *)"evh__HG_PTHREAD_MUTEX_INIT_POST", "");
7044   }   7044   }
7045   if (mbRec) {   7045   if (mbRec) {
7046     tmp = 1001;   7046     tmp = 1001;
7047   } else {   7047   } else {
7048     tmp = 1002;   7048     tmp = 1002;
7049   }   7049   }
7050   map_locks_lookup_or_create((LockKind )tmp, (Addr )mutex, tid);   7050   map_locks_lookup_or_create((LockKind )tmp, (Addr )mutex, tid);
7051   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7051   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7052     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_INIT_POST");   7052     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_INIT_POST");
7053   } else {   7053   } else {
7054     7054  
7055   }   7055   }
7056   return;   7056   return;
7057 }   7057 }
7058 }   7058 }
7059 static void evh__HG_PTHREAD_MUTEX_DESTROY_PRE(ThreadId tid , void *mutex )   7059 static void evh__HG_PTHREAD_MUTEX_DESTROY_PRE(ThreadId tid , void *mutex )
7060 {   7060 {
7061   Thread *thr ;   7061   Thread *thr ;
7062   Lock *lk ;   7062   Lock *lk ;
7063   Bool tmp ;   7063   Bool tmp ;
7064   Bool tmp___0 ;   7064   Bool tmp___0 ;
7065   Bool tmp___1 ;   7065   Bool tmp___1 ;
7066     7066  
7067   {   7067   {
7068   thr = map_threads_maybe_lookup(tid);   7068   thr = map_threads_maybe_lookup(tid);
7069   tmp = vgHelgrind_is_sane_Thread(thr);   7069   tmp = vgHelgrind_is_sane_Thread(thr);
7070   if (tmp) {   7070   if (tmp) {
7071     7071  
7072   } else {   7072   } else {
7073     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   7073     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
7074                         (Char const   *)"hg_main.c", 1821,   7074                         (Char const   *)"hg_main.c", 1821,
7075                         (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE", "");   7075                         (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE", "");
7076   }   7076   }
7077   lk = map_locks_maybe_lookup((Addr )mutex);   7077   lk = map_locks_maybe_lookup((Addr )mutex);
7078   if ((unsigned int )lk == (unsigned int )((void *)0)) {   7078   if ((unsigned int )lk == (unsigned int )((void *)0)) {
7079     vgHelgrind_record_error_Misc(thr,   7079     vgHelgrind_record_error_Misc(thr,
7080                                  (HChar *)"pthread_mutex_destroy with invalid argument");   7080                                  (HChar *)"pthread_mutex_destroy with invalid argument");
7081   } else   7081   } else
7082   if ((unsigned int )lk->kind != 1002U) {   7082   if ((unsigned int )lk->kind != 1002U) {
7083     if ((unsigned int )lk->kind != 1001U) {   7083     if ((unsigned int )lk->kind != 1001U) {
7084       vgHelgrind_record_error_Misc(thr,   7084       vgHelgrind_record_error_Misc(thr,
7085                                    (HChar *)"pthread_mutex_destroy with invalid argument");   7085                                    (HChar *)"pthread_mutex_destroy with invalid argument");
7086     } else {   7086     } else {
7087     7087  
7088     }   7088     }
7089   } else {   7089   } else {
7090     7090  
7091   }   7091   }
7092   if (lk) {   7092   if (lk) {
7093     tmp___0 = vgHelgrind_is_sane_LockN(lk);   7093     tmp___0 = vgHelgrind_is_sane_LockN(lk);
7094     if (tmp___0) {   7094     if (tmp___0) {
7095     7095  
7096     } else {   7096     } else {
7097       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7097       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7098                           (Char const   *)"hg_main.c", 1831,   7098                           (Char const   *)"hg_main.c", 1831,
7099                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7099                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7100                           "");   7100                           "");
7101     }   7101     }
7102     if (lk->guestaddr == (Addr )mutex) {   7102     if (lk->guestaddr == (Addr )mutex) {
7103     7103  
7104     } else {   7104     } else {
7105       vgPlain_assert_fail((Bool )0,   7105       vgPlain_assert_fail((Bool )0,
7106                           (Char const   *)"lk->guestaddr == (Addr)mutex",   7106                           (Char const   *)"lk->guestaddr == (Addr)mutex",
7107                           (Char const   *)"hg_main.c", 1832,   7107                           (Char const   *)"hg_main.c", 1832,
7108                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7108                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7109                           "");   7109                           "");
7110     }   7110     }
7111     if (lk->heldBy) {   7111     if (lk->heldBy) {
7112       vgHelgrind_record_error_Misc(thr,   7112       vgHelgrind_record_error_Misc(thr,
7113                                    (HChar *)"pthread_mutex_destroy of a locked mutex");   7113                                    (HChar *)"pthread_mutex_destroy of a locked mutex");
7114       remove_Lock_from_locksets_of_all_owning_Threads(lk);   7114       remove_Lock_from_locksets_of_all_owning_Threads(lk);
7115       vgPlain_deleteBag(lk->heldBy);   7115       vgPlain_deleteBag(lk->heldBy);
7116       lk->heldBy = (WordBag *)((void *)0);   7116       lk->heldBy = (WordBag *)((void *)0);
7117       lk->heldW = (Bool )0;   7117       lk->heldW = (Bool )0;
7118       lk->acquired_at = (ExeContext *)((void *)0);   7118       lk->acquired_at = (ExeContext *)((void *)0);
7119     } else {   7119     } else {
7120     7120  
7121     }   7121     }
7122     if (! lk->heldBy) {   7122     if (! lk->heldBy) {
7123     7123  
7124     } else {   7124     } else {
7125       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",   7125       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",
7126                           (Char const   *)"hg_main.c", 1844,   7126                           (Char const   *)"hg_main.c", 1844,
7127                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7127                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7128                           "");   7128                           "");
7129     }   7129     }
7130     tmp___1 = vgHelgrind_is_sane_LockN(lk);   7130     tmp___1 = vgHelgrind_is_sane_LockN(lk);
7131     if (tmp___1) {   7131     if (tmp___1) {
7132     7132  
7133     } else {   7133     } else {
7134       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7134       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7135                           (Char const   *)"hg_main.c", 1845,   7135                           (Char const   *)"hg_main.c", 1845,
7136                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7136                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7137                           "");   7137                           "");
7138     }   7138     }
7139     if (vgHelgrind_clo_track_lockorders) {   7139     if (vgHelgrind_clo_track_lockorders) {
7140       laog__handle_one_lock_deletion(lk);   7140       laog__handle_one_lock_deletion(lk);
7141     } else {   7141     } else {
7142     7142  
7143     }   7143     }
7144     map_locks_delete(lk->guestaddr);   7144     map_locks_delete(lk->guestaddr);
7145     del_LockN(lk);   7145     del_LockN(lk);
7146   } else {   7146   } else {
7147     7147  
7148   }   7148   }
7149   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7149   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7150     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_DESTROY_PRE");   7150     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_DESTROY_PRE");
7151   } else {   7151   } else {
7152     7152  
7153   }   7153   }
7154   return;   7154   return;
7155 }   7155 }
7156 }   7156 }
7157 static void evh__HG_PTHREAD_MUTEX_LOCK_PRE(ThreadId tid , void *mutex ,   7157 static void evh__HG_PTHREAD_MUTEX_LOCK_PRE(ThreadId tid , void *mutex ,
7158                                            Word isTryLock )   7158                                            Word isTryLock )
7159 {   7159 {
7160   Thread *thr ;   7160   Thread *thr ;
7161   Lock *lk ;   7161   Lock *lk ;
7162   HChar *errstr ;   7162   HChar *errstr ;
7163   HChar *auxstr ;   7163   HChar *auxstr ;
7164   UWord tmp ;   7164   UWord tmp ;
7165     7165  
7166   {   7166   {
7167   if (isTryLock == 0L) {   7167   if (isTryLock == 0L) {
7168     7168  
7169   } else   7169   } else
7170   if (isTryLock == 1L) {   7170   if (isTryLock == 1L) {
7171     7171  
7172   } else {   7172   } else {
7173     vgPlain_assert_fail((Bool )0,   7173     vgPlain_assert_fail((Bool )0,
7174                         (Char const   *)"isTryLock == 0 || isTryLock == 1",   7174                         (Char const   *)"isTryLock == 0 || isTryLock == 1",
7175                         (Char const   *)"hg_main.c", 1868,   7175                         (Char const   *)"hg_main.c", 1868,
7176                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");   7176                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");
7177   }   7177   }
7178   thr = map_threads_maybe_lookup(tid);   7178   thr = map_threads_maybe_lookup(tid);
7179   if (thr) {   7179   if (thr) {
7180     7180  
7181   } else {   7181   } else {
7182     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7182     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7183                         (Char const   *)"hg_main.c", 1870,   7183                         (Char const   *)"hg_main.c", 1870,
7184                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");   7184                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");
7185   }   7185   }
7186   lk = map_locks_maybe_lookup((Addr )mutex);   7186   lk = map_locks_maybe_lookup((Addr )mutex);
7187   if (lk) {   7187   if (lk) {
7188     if ((unsigned int )lk->kind == 1003U) {   7188     if ((unsigned int )lk->kind == 1003U) {
7189       vgHelgrind_record_error_Misc(thr,   7189       vgHelgrind_record_error_Misc(thr,
7190                                    (HChar *)"pthread_mutex_lock with a pthread_rwlock_t* argument ");   7190                                    (HChar *)"pthread_mutex_lock with a pthread_rwlock_t* argument ");
7191     } else {   7191     } else {
7192     7192  
7193     }   7193     }
7194   } else {   7194   } else {
7195     7195  
7196   }   7196   }
7197   if (lk) {   7197   if (lk) {
7198     if (isTryLock == 0L) {   7198     if (isTryLock == 0L) {
7199       if ((unsigned int )lk->kind == 1002U) {   7199       if ((unsigned int )lk->kind == 1002U) {
7200         goto _L;   7200         goto _L;
7201       } else   7201       } else
7202       if ((unsigned int )lk->kind == 1003U) {   7202       if ((unsigned int )lk->kind == 1003U) {
7203         _L: /* CIL Label */   7203         _L: /* CIL Label */
7204         if (lk->heldBy) {   7204         if (lk->heldBy) {
7205           if (lk->heldW) {   7205           if (lk->heldW) {
7206             tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   7206             tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
7207             if (tmp > 0UL) {   7207             if (tmp > 0UL) {
7208               errstr = (HChar *)"Attempt to re-lock a non-recursive lock I already hold";   7208               errstr = (HChar *)"Attempt to re-lock a non-recursive lock I already hold";
7209               auxstr = (HChar *)"Lock was previously acquired";   7209               auxstr = (HChar *)"Lock was previously acquired";
7210               if (lk->acquired_at) {   7210               if (lk->acquired_at) {
7211                 vgHelgrind_record_error_Misc_w_aux(thr, errstr, auxstr,   7211                 vgHelgrind_record_error_Misc_w_aux(thr, errstr, auxstr,
7212                                                    lk->acquired_at);   7212                                                    lk->acquired_at);
7213               } else {   7213               } else {
7214                 vgHelgrind_record_error_Misc(thr, errstr);   7214                 vgHelgrind_record_error_Misc(thr, errstr);
7215               }   7215               }
7216             } else {   7216             } else {
7217     7217  
7218             }   7218             }
7219           } else {   7219           } else {
7220     7220  
7221           }   7221           }
7222         } else {   7222         } else {
7223     7223  
7224         }   7224         }
7225       } else {   7225       } else {
7226     7226  
7227       }   7227       }
7228     } else {   7228     } else {
7229     7229  
7230     }   7230     }
7231   } else {   7231   } else {
7232     7232  
7233   }   7233   }
7234   return;   7234   return;
7235 }   7235 }
7236 }   7236 }
7237 static void evh__HG_PTHREAD_MUTEX_LOCK_POST(ThreadId tid , void *mutex )   7237 static void evh__HG_PTHREAD_MUTEX_LOCK_POST(ThreadId tid , void *mutex )
7238 {   7238 {
7239   Thread *thr ;   7239   Thread *thr ;
7240     7240  
7241   {   7241   {
7242   thr = map_threads_maybe_lookup(tid);   7242   thr = map_threads_maybe_lookup(tid);
7243   if (thr) {   7243   if (thr) {
7244     7244  
7245   } else {   7245   } else {
7246     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7246     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7247                         (Char const   *)"hg_main.c", 1909,   7247                         (Char const   *)"hg_main.c", 1909,
7248                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_POST", "");   7248                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_POST", "");
7249   }   7249   }
7250   evhH__post_thread_w_acquires_lock(thr, (LockKind )1001, (Addr )mutex);   7250   evhH__post_thread_w_acquires_lock(thr, (LockKind )1001, (Addr )mutex);
7251   return;   7251   return;
7252 }   7252 }
7253 }   7253 }
7254 static void evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(ThreadId tid , void *mutex )   7254 static void evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(ThreadId tid , void *mutex )
7255 {   7255 {
7256   Thread *thr ;   7256   Thread *thr ;
7257     7257  
7258   {   7258   {
7259   thr = map_threads_maybe_lookup(tid);   7259   thr = map_threads_maybe_lookup(tid);
7260   if (thr) {   7260   if (thr) {
7261     7261  
7262   } else {   7262   } else {
7263     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7263     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7264                         (Char const   *)"hg_main.c", 1927,   7264                         (Char const   *)"hg_main.c", 1927,
7265                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_PRE", "");   7265                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_PRE", "");
7266   }   7266   }
7267   evhH__pre_thread_releases_lock(thr, (Addr )mutex, (Bool )0);   7267   evhH__pre_thread_releases_lock(thr, (Addr )mutex, (Bool )0);
7268   return;   7268   return;
7269 }   7269 }
7270 }   7270 }
7271 static void evh__HG_PTHREAD_MUTEX_UNLOCK_POST(ThreadId tid , void *mutex )   7271 static void evh__HG_PTHREAD_MUTEX_UNLOCK_POST(ThreadId tid , void *mutex )
7272 {   7272 {
7273   Thread *thr ;   7273   Thread *thr ;
7274     7274  
7275   {   7275   {
7276   thr = map_threads_maybe_lookup(tid);   7276   thr = map_threads_maybe_lookup(tid);
7277   if (thr) {   7277   if (thr) {
7278     7278  
7279   } else {   7279   } else {
7280     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7280     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7281                         (Char const   *)"hg_main.c", 1940,   7281                         (Char const   *)"hg_main.c", 1940,
7282                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_POST", "");   7282                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_POST", "");
7283   }   7283   }
7284   return;   7284   return;
7285 }   7285 }
7286 }   7286 }
7287 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(ThreadId tid , void *slock )   7287 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(ThreadId tid , void *slock )
7288 {   7288 {
7289   Thread *thr ;   7289   Thread *thr ;
7290   Lock *lk ;   7290   Lock *lk ;
7291   Bool tmp ;   7291   Bool tmp ;
7292     7292  
7293   {   7293   {
7294   thr = map_threads_maybe_lookup(tid);   7294   thr = map_threads_maybe_lookup(tid);
7295   tmp = vgHelgrind_is_sane_Thread(thr);   7295   tmp = vgHelgrind_is_sane_Thread(thr);
7296   if (tmp) {   7296   if (tmp) {
7297     7297  
7298   } else {   7298   } else {
7299     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   7299     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
7300                         (Char const   *)"hg_main.c", 1969,   7300                         (Char const   *)"hg_main.c", 1969,
7301                         (Char const   *)"evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE",   7301                         (Char const   *)"evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE",
7302                         "");   7302                         "");
7303   }   7303   }
7304   lk = map_locks_maybe_lookup((Addr )slock);   7304   lk = map_locks_maybe_lookup((Addr )slock);
7305   if (lk) {   7305   if (lk) {
7306     if (lk->heldBy) {   7306     if (lk->heldBy) {
7307       evhH__pre_thread_releases_lock(thr, (Addr )slock, (Bool )0);   7307       evhH__pre_thread_releases_lock(thr, (Addr )slock, (Bool )0);
7308     } else {   7308     } else {
7309     7309  
7310     }   7310     }
7311   } else {   7311   } else {
7312     7312  
7313   }   7313   }
7314   return;   7314   return;
7315 }   7315 }
7316 }   7316 }
7317 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(ThreadId tid , void *slock )   7317 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(ThreadId tid , void *slock )
7318 {   7318 {
7319   Lock *lk ;   7319   Lock *lk ;
7320     7320  
7321   {   7321   {
7322   lk = map_locks_maybe_lookup((Addr )slock);   7322   lk = map_locks_maybe_lookup((Addr )slock);
7323   if (! lk) {   7323   if (! lk) {
7324     map_locks_lookup_or_create((LockKind )1002, (Addr )slock, tid);   7324     map_locks_lookup_or_create((LockKind )1002, (Addr )slock, tid);
7325   } else {   7325   } else {
7326     7326  
7327   }   7327   }
7328   return;   7328   return;
7329 }   7329 }
7330 }   7330 }
7331 static void evh__HG_PTHREAD_SPIN_LOCK_PRE(ThreadId tid , void *slock ,   7331 static void evh__HG_PTHREAD_SPIN_LOCK_PRE(ThreadId tid , void *slock ,
7332                                           Word isTryLock )   7332                                           Word isTryLock )
7333 {   7333 {
7334     7334  
7335     7335  
7336   {   7336   {
7337   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, slock, isTryLock);   7337   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, slock, isTryLock);
7338   return;   7338   return;
7339 }   7339 }
7340 }   7340 }
7341 static void evh__HG_PTHREAD_SPIN_LOCK_POST(ThreadId tid , void *slock )   7341 static void evh__HG_PTHREAD_SPIN_LOCK_POST(ThreadId tid , void *slock )
7342 {   7342 {
7343     7343  
7344     7344  
7345   {   7345   {
7346   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, slock);   7346   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, slock);
7347   return;   7347   return;
7348 }   7348 }
7349 }   7349 }
7350 static void evh__HG_PTHREAD_SPIN_DESTROY_PRE(ThreadId tid , void *slock )   7350 static void evh__HG_PTHREAD_SPIN_DESTROY_PRE(ThreadId tid , void *slock )
7351 {   7351 {
7352     7352  
7353     7353  
7354   {   7354   {
7355   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, slock);   7355   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, slock);
7356   return;   7356   return;
7357 }   7357 }
7358 }   7358 }
7359 static WordFM *map_cond_to_CVInfo  =    (WordFM *)((void *)0);   7359 static WordFM *map_cond_to_CVInfo  =    (WordFM *)((void *)0);
7360 static void map_cond_to_CVInfo_INIT(void)   7360 static void map_cond_to_CVInfo_INIT(void)
7361 {   7361 {
7362   long tmp ;   7362   long tmp ;
7363     7363  
7364   {   7364   {
7365   tmp = __builtin_expect((long )((unsigned int )map_cond_to_CVInfo == (unsigned int )((void *)0)),   7365   tmp = __builtin_expect((long )((unsigned int )map_cond_to_CVInfo == (unsigned int )((void *)0)),
7366                          0L);   7366                          0L);
7367   if (tmp) {   7367   if (tmp) {
7368     map_cond_to_CVInfo = vgPlain_newFM(& vgHelgrind_zalloc,   7368     map_cond_to_CVInfo = vgPlain_newFM(& vgHelgrind_zalloc,
7369                                        (HChar *)"hg.mctCI.1", & vgHelgrind_free,   7369                                        (HChar *)"hg.mctCI.1", & vgHelgrind_free,
7370                                        (Word (*)(UWord  , UWord  ))((void *)0));   7370                                        (Word (*)(UWord  , UWord  ))((void *)0));
7371     if ((unsigned int )map_cond_to_CVInfo != (unsigned int )((void *)0)) {   7371     if ((unsigned int )map_cond_to_CVInfo != (unsigned int )((void *)0)) {
7372     7372  
7373     } else {   7373     } else {
7374       vgPlain_assert_fail((Bool )0,   7374       vgPlain_assert_fail((Bool )0,
7375                           (Char const   *)"map_cond_to_CVInfo != NULL",   7375                           (Char const   *)"map_cond_to_CVInfo != NULL",
7376                           (Char const   *)"hg_main.c", 2055,   7376                           (Char const   *)"hg_main.c", 2055,
7377                           (Char const   *)"map_cond_to_CVInfo_INIT", "");   7377                           (Char const   *)"map_cond_to_CVInfo_INIT", "");
7378     }   7378     }
7379   } else {   7379   } else {
7380     7380  
7381   }   7381   }
7382   return;   7382   return;
7383 }   7383 }
7384 }   7384 }
7385 static CVInfo *map_cond_to_CVInfo_lookup_or_alloc(void *cond )   7385 static CVInfo *map_cond_to_CVInfo_lookup_or_alloc(void *cond )
7386 {   7386 {
7387   UWord key ;   7387   UWord key ;
7388   UWord val ;   7388   UWord val ;
7389   SO *so ;   7389   SO *so ;
7390   SO *tmp ;   7390   SO *tmp ;
7391   CVInfo *cvi ;   7391   CVInfo *cvi ;
7392   void *tmp___0 ;   7392   void *tmp___0 ;
7393   Bool tmp___1 ;   7393   Bool tmp___1 ;
7394     7394  
7395   {   7395   {
7396   map_cond_to_CVInfo_INIT();   7396   map_cond_to_CVInfo_INIT();
7397   tmp___1 = vgPlain_lookupFM(map_cond_to_CVInfo, & key, & val, (UWord )cond);   7397   tmp___1 = vgPlain_lookupFM(map_cond_to_CVInfo, & key, & val, (UWord )cond);
7398   if (tmp___1) {   7398   if (tmp___1) {
7399     if (key == (UWord )cond) {   7399     if (key == (UWord )cond) {
7400     7400  
7401     } else {   7401     } else {
7402       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)cond",   7402       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)cond",
7403                           (Char const   *)"hg_main.c", 2063,   7403                           (Char const   *)"hg_main.c", 2063,
7404                           (Char const   *)"map_cond_to_CVInfo_lookup_or_alloc",   7404                           (Char const   *)"map_cond_to_CVInfo_lookup_or_alloc",
7405                           "");   7405                           "");
7406     }   7406     }
7407     return ((CVInfo *)val);   7407     return ((CVInfo *)val);
7408   } else {   7408   } else {
7409     tmp = libhb_so_alloc();   7409     tmp = libhb_so_alloc();
7410     so = tmp;   7410     so = tmp;
7411     tmp___0 = vgHelgrind_zalloc((HChar *)"hg.mctCloa.1", (SizeT )sizeof(CVInfo ));   7411     tmp___0 = vgHelgrind_zalloc((HChar *)"hg.mctCloa.1", (SizeT )sizeof(CVInfo ));
7412     cvi = (CVInfo *)tmp___0;   7412     cvi = (CVInfo *)tmp___0;
7413     cvi->so = so;   7413     cvi->so = so;
7414     cvi->mx_ga = (void *)0;   7414     cvi->mx_ga = (void *)0;
7415     vgPlain_addToFM(map_cond_to_CVInfo, (UWord )cond, (UWord )cvi);   7415     vgPlain_addToFM(map_cond_to_CVInfo, (UWord )cond, (UWord )cvi);
7416     return (cvi);   7416     return (cvi);
7417   }   7417   }
7418 }   7418 }
7419 }   7419 }
7420 static void map_cond_to_CVInfo_delete(void *cond )   7420 static void map_cond_to_CVInfo_delete(void *cond )
7421 {   7421 {
7422   UWord keyW ;   7422   UWord keyW ;
7423   UWord valW ;   7423   UWord valW ;
7424   CVInfo *cvi ;   7424   CVInfo *cvi ;
7425   Bool tmp ;   7425   Bool tmp ;
7426     7426  
7427   {   7427   {
7428   map_cond_to_CVInfo_INIT();   7428   map_cond_to_CVInfo_INIT();
7429   tmp = vgPlain_delFromFM(map_cond_to_CVInfo, & keyW, & valW, (UWord )cond);   7429   tmp = vgPlain_delFromFM(map_cond_to_CVInfo, & keyW, & valW, (UWord )cond);
7430   if (tmp) {   7430   if (tmp) {
7431     cvi = (CVInfo *)valW;   7431     cvi = (CVInfo *)valW;
7432     if (keyW == (UWord )cond) {   7432     if (keyW == (UWord )cond) {
7433     7433  
7434     } else {   7434     } else {
7435       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)cond",   7435       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)cond",
7436                           (Char const   *)"hg_main.c", 2080,   7436                           (Char const   *)"hg_main.c", 2080,
7437                           (Char const   *)"map_cond_to_CVInfo_delete", "");   7437                           (Char const   *)"map_cond_to_CVInfo_delete", "");
7438     }   7438     }
7439     if (cvi) {   7439     if (cvi) {
7440     7440  
7441     } else {   7441     } else {
7442       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7442       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7443                           (Char const   *)"hg_main.c", 2081,   7443                           (Char const   *)"hg_main.c", 2081,
7444                           (Char const   *)"map_cond_to_CVInfo_delete", "");   7444                           (Char const   *)"map_cond_to_CVInfo_delete", "");
7445     }   7445     }
7446     if (cvi->so) {   7446     if (cvi->so) {
7447     7447  
7448     } else {   7448     } else {
7449       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7449       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7450                           (Char const   *)"hg_main.c", 2082,   7450                           (Char const   *)"hg_main.c", 2082,
7451                           (Char const   *)"map_cond_to_CVInfo_delete", "");   7451                           (Char const   *)"map_cond_to_CVInfo_delete", "");
7452     }   7452     }
7453     libhb_so_dealloc(cvi->so);   7453     libhb_so_dealloc(cvi->so);
7454     cvi->mx_ga = (void *)0;   7454     cvi->mx_ga = (void *)0;
7455     vgHelgrind_free((void *)cvi);   7455     vgHelgrind_free((void *)cvi);
7456   } else {   7456   } else {
7457     7457  
7458   }   7458   }
7459   return;   7459   return;
7460 }   7460 }
7461 }   7461 }
7462 static void evh__HG_PTHREAD_COND_SIGNAL_PRE(ThreadId tid , void *cond )   7462 static void evh__HG_PTHREAD_COND_SIGNAL_PRE(ThreadId tid , void *cond )
7463 {   7463 {
7464   Thread *thr ;   7464   Thread *thr ;
7465   CVInfo *cvi ;   7465   CVInfo *cvi ;
7466     7466  
7467   {   7467   {
7468   thr = map_threads_maybe_lookup(tid);   7468   thr = map_threads_maybe_lookup(tid);
7469   if (thr) {   7469   if (thr) {
7470     7470  
7471   } else {   7471   } else {
7472     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7472     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7473                         (Char const   *)"hg_main.c", 2106,   7473                         (Char const   *)"hg_main.c", 2106,
7474                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");   7474                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");
7475   }   7475   }
7476   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);   7476   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);
7477   if (cvi) {   7477   if (cvi) {
7478     7478  
7479   } else {   7479   } else {
7480     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7480     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7481                         (Char const   *)"hg_main.c", 2109,   7481                         (Char const   *)"hg_main.c", 2109,
7482                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");   7482                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");
7483   }   7483   }
7484   if (cvi->so) {   7484   if (cvi->so) {
7485     7485  
7486   } else {   7486   } else {
7487     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7487     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7488                         (Char const   *)"hg_main.c", 2110,   7488                         (Char const   *)"hg_main.c", 2110,
7489                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");   7489                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");
7490   }   7490   }
7491   libhb_so_send(thr->hbthr, cvi->so, (Bool )1);   7491   libhb_so_send(thr->hbthr, cvi->so, (Bool )1);
7492   return;   7492   return;
7493 }   7493 }
7494 }   7494 }
7495 static Bool evh__HG_PTHREAD_COND_WAIT_PRE(ThreadId tid , void *cond ,   7495 static Bool evh__HG_PTHREAD_COND_WAIT_PRE(ThreadId tid , void *cond ,
7496                                           void *mutex )   7496                                           void *mutex )
7497 {   7497 {
7498   Thread *thr ;   7498   Thread *thr ;
7499   Lock *lk ;   7499   Lock *lk ;
7500   Bool lk_valid ;   7500   Bool lk_valid ;
7501   CVInfo *cvi ;   7501   CVInfo *cvi ;
7502   Bool tmp ;   7502   Bool tmp ;
7503   UWord tmp___0 ;   7503   UWord tmp___0 ;
7504     7504  
7505   {   7505   {
7506   lk_valid = (Bool )1;   7506   lk_valid = (Bool )1;
7507   thr = map_threads_maybe_lookup(tid);   7507   thr = map_threads_maybe_lookup(tid);
7508   if (thr) {   7508   if (thr) {
7509     7509  
7510   } else {   7510   } else {
7511     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7511     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7512                         (Char const   *)"hg_main.c", 2163,   7512                         (Char const   *)"hg_main.c", 2163,
7513                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7513                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7514   }   7514   }
7515   lk = map_locks_maybe_lookup((Addr )mutex);   7515   lk = map_locks_maybe_lookup((Addr )mutex);
7516   if ((unsigned int )lk == (unsigned int )((void *)0)) {   7516   if ((unsigned int )lk == (unsigned int )((void *)0)) {
7517     lk_valid = (Bool )0;   7517     lk_valid = (Bool )0;
7518     vgHelgrind_record_error_Misc(thr,   7518     vgHelgrind_record_error_Misc(thr,
7519                                  (HChar *)"pthread_cond_{timed}wait called with invalid mutex");   7519                                  (HChar *)"pthread_cond_{timed}wait called with invalid mutex");
7520   } else {   7520   } else {
7521     tmp = vgHelgrind_is_sane_LockN(lk);   7521     tmp = vgHelgrind_is_sane_LockN(lk);
7522     if (tmp) {   7522     if (tmp) {
7523     7523  
7524     } else {   7524     } else {
7525       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7525       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7526                           (Char const   *)"hg_main.c", 2176,   7526                           (Char const   *)"hg_main.c", 2176,
7527                           (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7527                           (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7528     }   7528     }
7529     if ((unsigned int )lk->kind == 1003U) {   7529     if ((unsigned int )lk->kind == 1003U) {
7530       lk_valid = (Bool )0;   7530       lk_valid = (Bool )0;
7531       vgHelgrind_record_error_Misc(thr,   7531       vgHelgrind_record_error_Misc(thr,
7532                                    (HChar *)"pthread_cond_{timed}wait called with mutex of type pthread_rwlock_t*");   7532                                    (HChar *)"pthread_cond_{timed}wait called with mutex of type pthread_rwlock_t*");
7533     } else   7533     } else
7534     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   7534     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
7535       lk_valid = (Bool )0;   7535       lk_valid = (Bool )0;
7536       vgHelgrind_record_error_Misc(thr,   7536       vgHelgrind_record_error_Misc(thr,
7537                                    (HChar *)"pthread_cond_{timed}wait called with un-held mutex");   7537                                    (HChar *)"pthread_cond_{timed}wait called with un-held mutex");
7538     } else   7538     } else
7539     if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   7539     if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
7540       tmp___0 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   7540       tmp___0 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
7541       if (tmp___0 == 0UL) {   7541       if (tmp___0 == 0UL) {
7542         lk_valid = (Bool )0;   7542         lk_valid = (Bool )0;
7543         vgHelgrind_record_error_Misc(thr,   7543         vgHelgrind_record_error_Misc(thr,
7544                                      (HChar *)"pthread_cond_{timed}wait called with mutex held by a different thread");   7544                                      (HChar *)"pthread_cond_{timed}wait called with mutex held by a different thread");
7545       } else {   7545       } else {
7546     7546  
7547       }   7547       }
7548     } else {   7548     } else {
7549     7549  
7550     }   7550     }
7551   }   7551   }
7552   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);   7552   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);
7553   if (cvi) {   7553   if (cvi) {
7554     7554  
7555   } else {   7555   } else {
7556     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7556     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7557                         (Char const   *)"hg_main.c", 2199,   7557                         (Char const   *)"hg_main.c", 2199,
7558                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7558                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7559   }   7559   }
7560   if (cvi->so) {   7560   if (cvi->so) {
7561     7561  
7562   } else {   7562   } else {
7563     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7563     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7564                         (Char const   *)"hg_main.c", 2200,   7564                         (Char const   *)"hg_main.c", 2200,
7565                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7565                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7566   }   7566   }
7567   if (cvi->nWaiters == 0UL) {   7567   if (cvi->nWaiters == 0UL) {
7568     cvi->mx_ga = mutex;   7568     cvi->mx_ga = mutex;
7569   } else   7569   } else
7570   if ((unsigned int )cvi->mx_ga != (unsigned int )mutex) {   7570   if ((unsigned int )cvi->mx_ga != (unsigned int )mutex) {
7571     vgHelgrind_record_error_Misc(thr,   7571     vgHelgrind_record_error_Misc(thr,
7572                                  (HChar *)"pthread_cond_{timed}wait: cond is associated with a different mutex");   7572                                  (HChar *)"pthread_cond_{timed}wait: cond is associated with a different mutex");
7573   } else {   7573   } else {
7574     7574  
7575   }   7575   }
7576   (cvi->nWaiters) ++;   7576   (cvi->nWaiters) ++;
7577   return (lk_valid);   7577   return (lk_valid);
7578 }   7578 }
7579 }   7579 }
7580 static void evh__HG_PTHREAD_COND_WAIT_POST(ThreadId tid , void *cond ,   7580 static void evh__HG_PTHREAD_COND_WAIT_POST(ThreadId tid , void *cond ,
7581                                            void *mutex )   7581                                            void *mutex )
7582 {   7582 {
7583   Thread *thr ;   7583   Thread *thr ;
7584   CVInfo *cvi ;   7584   CVInfo *cvi ;
7585   Bool tmp ;   7585   Bool tmp ;
7586     7586  
7587   {   7587   {
7588   thr = map_threads_maybe_lookup(tid);   7588   thr = map_threads_maybe_lookup(tid);
7589   if (thr) {   7589   if (thr) {
7590     7590  
7591   } else {   7591   } else {
7592     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7592     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7593                         (Char const   *)"hg_main.c", 2231,   7593                         (Char const   *)"hg_main.c", 2231,
7594                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7594                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7595   }   7595   }
7596   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);   7596   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);
7597   if (cvi) {   7597   if (cvi) {
7598     7598  
7599   } else {   7599   } else {
7600     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7600     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7601                         (Char const   *)"hg_main.c", 2236,   7601                         (Char const   *)"hg_main.c", 2236,
7602                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7602                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7603   }   7603   }
7604   if (cvi->so) {   7604   if (cvi->so) {
7605     7605  
7606   } else {   7606   } else {
7607     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7607     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7608                         (Char const   *)"hg_main.c", 2237,   7608                         (Char const   *)"hg_main.c", 2237,
7609                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7609                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7610   }   7610   }
7611   if (cvi->nWaiters > 0UL) {   7611   if (cvi->nWaiters > 0UL) {
7612     7612  
7613   } else {   7613   } else {
7614     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->nWaiters > 0",   7614     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->nWaiters > 0",
7615                         (Char const   *)"hg_main.c", 2238,   7615                         (Char const   *)"hg_main.c", 2238,
7616                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7616                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7617   }   7617   }
7618   tmp = libhb_so_everSent(cvi->so);   7618   tmp = libhb_so_everSent(cvi->so);
7619   if (tmp) {   7619   if (tmp) {
7620     7620  
7621   } else {   7621   } else {
7622     vgHelgrind_record_error_Misc(thr,   7622     vgHelgrind_record_error_Misc(thr,
7623                                  (HChar *)"Bug in libpthread: pthread_cond_wait succeeded on without prior pthread_cond_post");   7623                                  (HChar *)"Bug in libpthread: pthread_cond_wait succeeded on without prior pthread_cond_post");
7624   }   7624   }
7625   libhb_so_recv(thr->hbthr, cvi->so, (Bool )1);   7625   libhb_so_recv(thr->hbthr, cvi->so, (Bool )1);
7626   (cvi->nWaiters) --;   7626   (cvi->nWaiters) --;
7627   return;   7627   return;
7628 }   7628 }
7629 }   7629 }
7630 static void evh__HG_PTHREAD_COND_DESTROY_PRE(ThreadId tid , void *cond )   7630 static void evh__HG_PTHREAD_COND_DESTROY_PRE(ThreadId tid , void *cond )
7631 {   7631 {
7632     7632  
7633     7633  
7634   {   7634   {
7635   map_cond_to_CVInfo_delete(cond);   7635   map_cond_to_CVInfo_delete(cond);
7636   return;   7636   return;
7637 }   7637 }
7638 }   7638 }
7639 static void evh__HG_PTHREAD_RWLOCK_INIT_POST(ThreadId tid , void *rwl )   7639 static void evh__HG_PTHREAD_RWLOCK_INIT_POST(ThreadId tid , void *rwl )
7640 {   7640 {
7641     7641  
7642     7642  
7643   {   7643   {
7644   map_locks_lookup_or_create((LockKind )1003, (Addr )rwl, tid);   7644   map_locks_lookup_or_create((LockKind )1003, (Addr )rwl, tid);
7645   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7645   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7646     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_INIT_POST");   7646     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_INIT_POST");
7647   } else {   7647   } else {
7648     7648  
7649   }   7649   }
7650   return;   7650   return;
7651 }   7651 }
7652 }   7652 }
7653 static void evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(ThreadId tid , void *rwl )   7653 static void evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(ThreadId tid , void *rwl )
7654 {   7654 {
7655   Thread *thr ;   7655   Thread *thr ;
7656   Lock *lk ;   7656   Lock *lk ;
7657   Bool tmp ;   7657   Bool tmp ;
7658   Bool tmp___0 ;   7658   Bool tmp___0 ;
7659   Bool tmp___1 ;   7659   Bool tmp___1 ;
7660     7660  
7661   {   7661   {
7662   thr = map_threads_maybe_lookup(tid);   7662   thr = map_threads_maybe_lookup(tid);
7663   tmp = vgHelgrind_is_sane_Thread(thr);   7663   tmp = vgHelgrind_is_sane_Thread(thr);
7664   if (tmp) {   7664   if (tmp) {
7665     7665  
7666   } else {   7666   } else {
7667     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   7667     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
7668                         (Char const   *)"hg_main.c", 2297,   7668                         (Char const   *)"hg_main.c", 2297,
7669                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE", "");   7669                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE", "");
7670   }   7670   }
7671   lk = map_locks_maybe_lookup((Addr )rwl);   7671   lk = map_locks_maybe_lookup((Addr )rwl);
7672   if ((unsigned int )lk == (unsigned int )((void *)0)) {   7672   if ((unsigned int )lk == (unsigned int )((void *)0)) {
7673     vgHelgrind_record_error_Misc(thr,   7673     vgHelgrind_record_error_Misc(thr,
7674                                  (HChar *)"pthread_rwlock_destroy with invalid argument");   7674                                  (HChar *)"pthread_rwlock_destroy with invalid argument");
7675   } else   7675   } else
7676   if ((unsigned int )lk->kind != 1003U) {   7676   if ((unsigned int )lk->kind != 1003U) {
7677     vgHelgrind_record_error_Misc(thr,   7677     vgHelgrind_record_error_Misc(thr,
7678                                  (HChar *)"pthread_rwlock_destroy with invalid argument");   7678                                  (HChar *)"pthread_rwlock_destroy with invalid argument");
7679   } else {   7679   } else {
7680     7680  
7681   }   7681   }
7682   if (lk) {   7682   if (lk) {
7683     tmp___0 = vgHelgrind_is_sane_LockN(lk);   7683     tmp___0 = vgHelgrind_is_sane_LockN(lk);
7684     if (tmp___0) {   7684     if (tmp___0) {
7685     7685  
7686     } else {   7686     } else {
7687       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7687       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7688                           (Char const   *)"hg_main.c", 2307,   7688                           (Char const   *)"hg_main.c", 2307,
7689                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7689                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7690                           "");   7690                           "");
7691     }   7691     }
7692     if (lk->guestaddr == (Addr )rwl) {   7692     if (lk->guestaddr == (Addr )rwl) {
7693     7693  
7694     } else {   7694     } else {
7695       vgPlain_assert_fail((Bool )0,   7695       vgPlain_assert_fail((Bool )0,
7696                           (Char const   *)"lk->guestaddr == (Addr)rwl",   7696                           (Char const   *)"lk->guestaddr == (Addr)rwl",
7697                           (Char const   *)"hg_main.c", 2308,   7697                           (Char const   *)"hg_main.c", 2308,
7698                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7698                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7699                           "");   7699                           "");
7700     }   7700     }
7701     if (lk->heldBy) {   7701     if (lk->heldBy) {
7702       vgHelgrind_record_error_Misc(thr,   7702       vgHelgrind_record_error_Misc(thr,
7703                                    (HChar *)"pthread_rwlock_destroy of a locked mutex");   7703                                    (HChar *)"pthread_rwlock_destroy of a locked mutex");
7704       remove_Lock_from_locksets_of_all_owning_Threads(lk);   7704       remove_Lock_from_locksets_of_all_owning_Threads(lk);
7705       vgPlain_deleteBag(lk->heldBy);   7705       vgPlain_deleteBag(lk->heldBy);
7706       lk->heldBy = (WordBag *)((void *)0);   7706       lk->heldBy = (WordBag *)((void *)0);
7707       lk->heldW = (Bool )0;   7707       lk->heldW = (Bool )0;
7708       lk->acquired_at = (ExeContext *)((void *)0);   7708       lk->acquired_at = (ExeContext *)((void *)0);
7709     } else {   7709     } else {
7710     7710  
7711     }   7711     }
7712     if (! lk->heldBy) {   7712     if (! lk->heldBy) {
7713     7713  
7714     } else {   7714     } else {
7715       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",   7715       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",
7716                           (Char const   *)"hg_main.c", 2320,   7716                           (Char const   *)"hg_main.c", 2320,
7717                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7717                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7718                           "");   7718                           "");
7719     }   7719     }
7720     tmp___1 = vgHelgrind_is_sane_LockN(lk);   7720     tmp___1 = vgHelgrind_is_sane_LockN(lk);
7721     if (tmp___1) {   7721     if (tmp___1) {
7722     7722  
7723     } else {   7723     } else {
7724       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7724       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7725                           (Char const   *)"hg_main.c", 2321,   7725                           (Char const   *)"hg_main.c", 2321,
7726                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7726                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7727                           "");   7727                           "");
7728     }   7728     }
7729     if (vgHelgrind_clo_track_lockorders) {   7729     if (vgHelgrind_clo_track_lockorders) {
7730       laog__handle_one_lock_deletion(lk);   7730       laog__handle_one_lock_deletion(lk);
7731     } else {   7731     } else {
7732     7732  
7733     }   7733     }
7734     map_locks_delete(lk->guestaddr);   7734     map_locks_delete(lk->guestaddr);
7735     del_LockN(lk);   7735     del_LockN(lk);
7736   } else {   7736   } else {
7737     7737  
7738   }   7738   }
7739   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7739   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7740     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_DESTROY_PRE");   7740     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_DESTROY_PRE");
7741   } else {   7741   } else {
7742     7742  
7743   }   7743   }
7744   return;   7744   return;
7745 }   7745 }
7746 }   7746 }
7747 static void evh__HG_PTHREAD_RWLOCK_LOCK_PRE(ThreadId tid , void *rwl ,   7747 static void evh__HG_PTHREAD_RWLOCK_LOCK_PRE(ThreadId tid , void *rwl ,
7748                                             Word isW , Word isTryLock )   7748                                             Word isW , Word isTryLock )
7749 {   7749 {
7750   Thread *thr ;   7750   Thread *thr ;
7751   Lock *lk ;   7751   Lock *lk ;
7752     7752  
7753   {   7753   {
7754   if (isW == 0L) {   7754   if (isW == 0L) {
7755     7755  
7756   } else   7756   } else
7757   if (isW == 1L) {   7757   if (isW == 1L) {
7758     7758  
7759   } else {   7759   } else {
7760     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",   7760     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",
7761                         (Char const   *)"hg_main.c", 2346,   7761                         (Char const   *)"hg_main.c", 2346,
7762                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");   7762                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");
7763   }   7763   }
7764   if (isTryLock == 0L) {   7764   if (isTryLock == 0L) {
7765     7765  
7766   } else   7766   } else
7767   if (isTryLock == 1L) {   7767   if (isTryLock == 1L) {
7768     7768  
7769   } else {   7769   } else {
7770     vgPlain_assert_fail((Bool )0,   7770     vgPlain_assert_fail((Bool )0,
7771                         (Char const   *)"isTryLock == 0 || isTryLock == 1",   7771                         (Char const   *)"isTryLock == 0 || isTryLock == 1",
7772                         (Char const   *)"hg_main.c", 2347,   7772                         (Char const   *)"hg_main.c", 2347,
7773                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");   7773                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");
7774   }   7774   }
7775   thr = map_threads_maybe_lookup(tid);   7775   thr = map_threads_maybe_lookup(tid);
7776   if (thr) {   7776   if (thr) {
7777     7777  
7778   } else {   7778   } else {
7779     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7779     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7780                         (Char const   *)"hg_main.c", 2349,   7780                         (Char const   *)"hg_main.c", 2349,
7781                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");   7781                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");
7782   }   7782   }
7783   lk = map_locks_maybe_lookup((Addr )rwl);   7783   lk = map_locks_maybe_lookup((Addr )rwl);
7784   if (lk) {   7784   if (lk) {
7785     if ((unsigned int )lk->kind == 1002U) {   7785     if ((unsigned int )lk->kind == 1002U) {
7786       vgHelgrind_record_error_Misc(thr,   7786       vgHelgrind_record_error_Misc(thr,
7787                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");   7787                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");
7788     } else   7788     } else
7789     if ((unsigned int )lk->kind == 1001U) {   7789     if ((unsigned int )lk->kind == 1001U) {
7790       vgHelgrind_record_error_Misc(thr,   7790       vgHelgrind_record_error_Misc(thr,
7791                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");   7791                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");
7792     } else {   7792     } else {
7793     7793  
7794     }   7794     }
7795   } else {   7795   } else {
7796     7796  
7797   }   7797   }
7798   return;   7798   return;
7799 }   7799 }
7800 }   7800 }
7801 static void evh__HG_PTHREAD_RWLOCK_LOCK_POST(ThreadId tid , void *rwl ,   7801 static void evh__HG_PTHREAD_RWLOCK_LOCK_POST(ThreadId tid , void *rwl ,
7802                                              Word isW )   7802                                              Word isW )
7803 {   7803 {
7804   Thread *thr ;   7804   Thread *thr ;
7805   void (*tmp)(Thread *thr , LockKind lkk , Addr lock_ga ) ;   7805   void (*tmp)(Thread *thr , LockKind lkk , Addr lock_ga ) ;
7806     7806  
7807   {   7807   {
7808   if (isW == 0L) {   7808   if (isW == 0L) {
7809     7809  
7810   } else   7810   } else
7811   if (isW == 1L) {   7811   if (isW == 1L) {
7812     7812  
7813   } else {   7813   } else {
7814     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",   7814     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",
7815                         (Char const   *)"hg_main.c", 2370,   7815                         (Char const   *)"hg_main.c", 2370,
7816                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");   7816                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");
7817   }   7817   }
7818   thr = map_threads_maybe_lookup(tid);   7818   thr = map_threads_maybe_lookup(tid);
7819   if (thr) {   7819   if (thr) {
7820     7820  
7821   } else {   7821   } else {
7822     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7822     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7823                         (Char const   *)"hg_main.c", 2372,   7823                         (Char const   *)"hg_main.c", 2372,
7824                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");   7824                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");
7825   }   7825   }
7826   if (isW) {   7826   if (isW) {
7827     tmp = & evhH__post_thread_w_acquires_lock;   7827     tmp = & evhH__post_thread_w_acquires_lock;
7828   } else {   7828   } else {
7829     tmp = & evhH__post_thread_r_acquires_lock;   7829     tmp = & evhH__post_thread_r_acquires_lock;
7830   }   7830   }
7831   (*tmp)(thr, (LockKind )1003, (Addr )rwl);   7831   (*tmp)(thr, (LockKind )1003, (Addr )rwl);
7832   return;   7832   return;
7833 }   7833 }
7834 }   7834 }
7835 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(ThreadId tid , void *rwl )   7835 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(ThreadId tid , void *rwl )
7836 {   7836 {
7837   Thread *thr ;   7837   Thread *thr ;
7838     7838  
7839   {   7839   {
7840   thr = map_threads_maybe_lookup(tid);   7840   thr = map_threads_maybe_lookup(tid);
7841   if (thr) {   7841   if (thr) {
7842     7842  
7843   } else {   7843   } else {
7844     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7844     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7845                         (Char const   *)"hg_main.c", 2391,   7845                         (Char const   *)"hg_main.c", 2391,
7846                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE", "");   7846                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE", "");
7847   }   7847   }
7848   evhH__pre_thread_releases_lock(thr, (Addr )rwl, (Bool )1);   7848   evhH__pre_thread_releases_lock(thr, (Addr )rwl, (Bool )1);
7849   return;   7849   return;
7850 }   7850 }
7851 }   7851 }
7852 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(ThreadId tid , void *rwl )   7852 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(ThreadId tid , void *rwl )
7853 {   7853 {
7854   Thread *thr ;   7854   Thread *thr ;
7855     7855  
7856   {   7856   {
7857   thr = map_threads_maybe_lookup(tid);   7857   thr = map_threads_maybe_lookup(tid);
7858   if (thr) {   7858   if (thr) {
7859     7859  
7860   } else {   7860   } else {
7861     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7861     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7862                         (Char const   *)"hg_main.c", 2404,   7862                         (Char const   *)"hg_main.c", 2404,
7863                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_POST", "");   7863                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_POST", "");
7864   }   7864   }
7865   return;   7865   return;
7866 }   7866 }
7867 }   7867 }
7868 static WordFM *map_sem_to_SO_stack  =    (WordFM *)((void *)0);   7868 static WordFM *map_sem_to_SO_stack  =    (WordFM *)((void *)0);
7869 static void map_sem_to_SO_stack_INIT(void)   7869 static void map_sem_to_SO_stack_INIT(void)
7870 {   7870 {
7871     7871  
7872     7872  
7873   {   7873   {
7874   if ((unsigned int )map_sem_to_SO_stack == (unsigned int )((void *)0)) {   7874   if ((unsigned int )map_sem_to_SO_stack == (unsigned int )((void *)0)) {
7875     map_sem_to_SO_stack = vgPlain_newFM(& vgHelgrind_zalloc,   7875     map_sem_to_SO_stack = vgPlain_newFM(& vgHelgrind_zalloc,
7876                                         (HChar *)"hg.mstSs.1",   7876                                         (HChar *)"hg.mstSs.1",
7877                                         & vgHelgrind_free,   7877                                         & vgHelgrind_free,
7878                                         (Word (*)(UWord  , UWord  ))((void *)0));   7878                                         (Word (*)(UWord  , UWord  ))((void *)0));
7879     if ((unsigned int )map_sem_to_SO_stack != (unsigned int )((void *)0)) {   7879     if ((unsigned int )map_sem_to_SO_stack != (unsigned int )((void *)0)) {
7880     7880  
7881     } else {   7881     } else {
7882       vgPlain_assert_fail((Bool )0,   7882       vgPlain_assert_fail((Bool )0,
7883                           (Char const   *)"map_sem_to_SO_stack != NULL",   7883                           (Char const   *)"map_sem_to_SO_stack != NULL",
7884                           (Char const   *)"hg_main.c", 2454,   7884                           (Char const   *)"hg_main.c", 2454,
7885                           (Char const   *)"map_sem_to_SO_stack_INIT", "");   7885                           (Char const   *)"map_sem_to_SO_stack_INIT", "");
7886     }   7886     }
7887   } else {   7887   } else {
7888     7888  
7889   }   7889   }
7890   return;   7890   return;
7891 }   7891 }
7892 }   7892 }
7893 static void push_SO_for_sem(void *sem , SO *so )   7893 static void push_SO_for_sem(void *sem , SO *so )
7894 {   7894 {
7895   UWord keyW ;   7895   UWord keyW ;
7896   XArray *xa ;   7896   XArray *xa ;
7897   Bool tmp ;   7897   Bool tmp ;
7898     7898  
7899   {   7899   {
7900   if (so) {   7900   if (so) {
7901     7901  
7902   } else {   7902   } else {
7903     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   7903     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
7904                         (Char const   *)"hg_main.c", 2461,   7904                         (Char const   *)"hg_main.c", 2461,
7905                         (Char const   *)"push_SO_for_sem", "");   7905                         (Char const   *)"push_SO_for_sem", "");
7906   }   7906   }
7907   map_sem_to_SO_stack_INIT();   7907   map_sem_to_SO_stack_INIT();
7908   tmp = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),   7908   tmp = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),
7909                          (UWord )sem);   7909                          (UWord )sem);
7910   if (tmp) {   7910   if (tmp) {
7911     if (keyW == (UWord )sem) {   7911     if (keyW == (UWord )sem) {
7912     7912  
7913     } else {   7913     } else {
7914       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",   7914       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",
7915                           (Char const   *)"hg_main.c", 2465,   7915                           (Char const   *)"hg_main.c", 2465,
7916                           (Char const   *)"push_SO_for_sem", "");   7916                           (Char const   *)"push_SO_for_sem", "");
7917     }   7917     }
7918     if (xa) {   7918     if (xa) {
7919     7919  
7920     } else {   7920     } else {
7921       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",   7921       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",
7922                           (Char const   *)"hg_main.c", 2466,   7922                           (Char const   *)"hg_main.c", 2466,
7923                           (Char const   *)"push_SO_for_sem", "");   7923                           (Char const   *)"push_SO_for_sem", "");
7924     }   7924     }
7925     vgPlain_addToXA(xa, (void *)(& so));   7925     vgPlain_addToXA(xa, (void *)(& so));
7926   } else {   7926   } else {
7927     xa = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.pSfs.1",   7927     xa = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.pSfs.1",
7928                        & vgHelgrind_free, (Word )sizeof(SO *));   7928                        & vgHelgrind_free, (Word )sizeof(SO *));
7929     vgPlain_addToXA(xa, (void *)(& so));   7929     vgPlain_addToXA(xa, (void *)(& so));
7930     vgPlain_addToFM(map_sem_to_SO_stack, (UWord )((Word )sem),   7930     vgPlain_addToFM(map_sem_to_SO_stack, (UWord )((Word )sem),
7931                     (UWord )((Word )xa));   7931                     (UWord )((Word )xa));
7932   }   7932   }
7933   return;   7933   return;
7934 }   7934 }
7935 }   7935 }
7936 static SO *mb_pop_SO_for_sem(void *sem )   7936 static SO *mb_pop_SO_for_sem(void *sem )
7937 {   7937 {
7938   UWord keyW ;   7938   UWord keyW ;
7939   XArray *xa ;   7939   XArray *xa ;
7940   SO *so ;   7940   SO *so ;
7941   Word sz ;   7941   Word sz ;
7942   void *tmp ;   7942   void *tmp ;
7943   Bool tmp___0 ;   7943   Bool tmp___0 ;
7944     7944  
7945   {   7945   {
7946   map_sem_to_SO_stack_INIT();   7946   map_sem_to_SO_stack_INIT();
7947   tmp___0 = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),   7947   tmp___0 = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),
7948                              (UWord )sem);   7948                              (UWord )sem);
7949   if (tmp___0) {   7949   if (tmp___0) {
7950     if (keyW == (UWord )sem) {   7950     if (keyW == (UWord )sem) {
7951     7951  
7952     } else {   7952     } else {
7953       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",   7953       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",
7954                           (Char const   *)"hg_main.c", 2484,   7954                           (Char const   *)"hg_main.c", 2484,
7955                           (Char const   *)"mb_pop_SO_for_sem", "");   7955                           (Char const   *)"mb_pop_SO_for_sem", "");
7956     }   7956     }
7957     sz = vgPlain_sizeXA(xa);   7957     sz = vgPlain_sizeXA(xa);
7958     if (sz >= 0L) {   7958     if (sz >= 0L) {
7959     7959  
7960     } else {   7960     } else {
7961       vgPlain_assert_fail((Bool )0, (Char const   *)"sz >= 0",   7961       vgPlain_assert_fail((Bool )0, (Char const   *)"sz >= 0",
7962                           (Char const   *)"hg_main.c", 2486,   7962                           (Char const   *)"hg_main.c", 2486,
7963                           (Char const   *)"mb_pop_SO_for_sem", "");   7963                           (Char const   *)"mb_pop_SO_for_sem", "");
7964     }   7964     }
7965     if (sz == 0L) {   7965     if (sz == 0L) {
7966       return ((SO *)((void *)0));   7966       return ((SO *)((void *)0));
7967     } else {   7967     } else {
7968     7968  
7969     }   7969     }
7970     tmp = vgPlain_indexXA(xa, sz - 1L);   7970     tmp = vgPlain_indexXA(xa, sz - 1L);
7971     so = *((SO **)tmp);   7971     so = *((SO **)tmp);
7972     if (so) {   7972     if (so) {
7973     7973  
7974     } else {   7974     } else {
7975       vgPlain_assert_fail((Bool )0, (Char const   *)"so",   7975       vgPlain_assert_fail((Bool )0, (Char const   *)"so",
7976                           (Char const   *)"hg_main.c", 2490,   7976                           (Char const   *)"hg_main.c", 2490,
7977                           (Char const   *)"mb_pop_SO_for_sem", "");   7977                           (Char const   *)"mb_pop_SO_for_sem", "");
7978     }   7978     }
7979     vgPlain_dropTailXA(xa, (Word )1);   7979     vgPlain_dropTailXA(xa, (Word )1);
7980     return (so);   7980     return (so);
7981   } else {   7981   } else {
7982     return ((SO *)((void *)0));   7982     return ((SO *)((void *)0));
7983   }   7983   }
7984 }   7984 }
7985 }   7985 }
7986 static void evh__HG_POSIX_SEM_DESTROY_PRE(ThreadId tid , void *sem )   7986 static void evh__HG_POSIX_SEM_DESTROY_PRE(ThreadId tid , void *sem )
7987 {   7987 {
7988   UWord keyW ;   7988   UWord keyW ;
7989   UWord valW ;   7989   UWord valW ;
7990   SO *so ;   7990   SO *so ;
7991   XArray *xa ;   7991   XArray *xa ;
7992   Word tmp ;   7992   Word tmp ;
7993   Bool tmp___0 ;   7993   Bool tmp___0 ;
7994     7994  
7995   {   7995   {
7996   map_sem_to_SO_stack_INIT();   7996   map_sem_to_SO_stack_INIT();
7997   while (1) {   7997   while (1) {
7998     so = mb_pop_SO_for_sem(sem);   7998     so = mb_pop_SO_for_sem(sem);
7999     if (! so) {   7999     if (! so) {
8000       break;   8000       break;
8001     } else {   8001     } else {
8002     8002  
8003     }   8003     }
8004     libhb_so_dealloc(so);   8004     libhb_so_dealloc(so);
8005   }   8005   }
8006   tmp___0 = vgPlain_delFromFM(map_sem_to_SO_stack, & keyW, & valW, (UWord )sem);   8006   tmp___0 = vgPlain_delFromFM(map_sem_to_SO_stack, & keyW, & valW, (UWord )sem);
8007   if (tmp___0) {   8007   if (tmp___0) {
8008     xa = (XArray *)valW;   8008     xa = (XArray *)valW;
8009     if (keyW == (UWord )sem) {   8009     if (keyW == (UWord )sem) {
8010     8010  
8011     } else {   8011     } else {
8012       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",   8012       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",
8013                           (Char const   *)"hg_main.c", 2520,   8013                           (Char const   *)"hg_main.c", 2520,
8014                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");   8014                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");
8015     }   8015     }
8016     if (xa) {   8016     if (xa) {
8017     8017  
8018     } else {   8018     } else {
8019       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",   8019       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",
8020                           (Char const   *)"hg_main.c", 2521,   8020                           (Char const   *)"hg_main.c", 2521,
8021                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");   8021                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");
8022     }   8022     }
8023     tmp = vgPlain_sizeXA(xa);   8023     tmp = vgPlain_sizeXA(xa);
8024     if (tmp == 0L) {   8024     if (tmp == 0L) {
8025     8025  
8026     } else {   8026     } else {
8027       vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(sizeXA)(xa) == 0",   8027       vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(sizeXA)(xa) == 0",
8028                           (Char const   *)"hg_main.c", 2522,   8028                           (Char const   *)"hg_main.c", 2522,
8029                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");   8029                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");
8030     }   8030     }
8031     vgPlain_deleteXA(xa);   8031     vgPlain_deleteXA(xa);
8032   } else {   8032   } else {
8033     8033  
8034   }   8034   }
8035   return;   8035   return;
8036 }   8036 }
8037 }   8037 }
8038 static void evh__HG_POSIX_SEM_INIT_POST(ThreadId tid , void *sem , UWord value )   8038 static void evh__HG_POSIX_SEM_INIT_POST(ThreadId tid , void *sem , UWord value )
8039 {   8039 {
8040   SO *so ;   8040   SO *so ;
8041   Thread *thr ;   8041   Thread *thr ;
8042   Thr *hbthr ;   8042   Thr *hbthr ;
8043     8043  
8044   {   8044   {
8045   thr = map_threads_maybe_lookup(tid);   8045   thr = map_threads_maybe_lookup(tid);
8046   if (thr) {   8046   if (thr) {
8047     8047  
8048   } else {   8048   } else {
8049     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8049     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8050                         (Char const   *)"hg_main.c", 2538,   8050                         (Char const   *)"hg_main.c", 2538,
8051                         (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");   8051                         (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");
8052   }   8052   }
8053   while (1) {   8053   while (1) {
8054     so = mb_pop_SO_for_sem(sem);   8054     so = mb_pop_SO_for_sem(sem);
8055     if (! so) {   8055     if (! so) {
8056       break;   8056       break;
8057     } else {   8057     } else {
8058     8058  
8059     }   8059     }
8060     libhb_so_dealloc(so);   8060     libhb_so_dealloc(so);
8061   }   8061   }
8062   if (value > 10000UL) {   8062   if (value > 10000UL) {
8063     vgHelgrind_record_error_Misc(thr,   8063     vgHelgrind_record_error_Misc(thr,
8064                                  (HChar *)"sem_init: initial value exceeds 10000; using 10000");   8064                                  (HChar *)"sem_init: initial value exceeds 10000; using 10000");
8065     value = (UWord )10000;   8065     value = (UWord )10000;
8066   } else {   8066   } else {
8067     8067  
8068   }   8068   }
8069   while (value > 0UL) {   8069   while (value > 0UL) {
8070     hbthr = thr->hbthr;   8070     hbthr = thr->hbthr;
8071     if (hbthr) {   8071     if (hbthr) {
8072     8072  
8073     } else {   8073     } else {
8074       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   8074       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
8075                           (Char const   *)"hg_main.c", 2560,   8075                           (Char const   *)"hg_main.c", 2560,
8076                           (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");   8076                           (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");
8077     }   8077     }
8078     so = libhb_so_alloc();   8078     so = libhb_so_alloc();
8079     libhb_so_send(hbthr, so, (Bool )1);   8079     libhb_so_send(hbthr, so, (Bool )1);
8080     push_SO_for_sem(sem, so);   8080     push_SO_for_sem(sem, so);
8081     value --;   8081     value --;
8082   }   8082   }
8083   return;   8083   return;
8084 }   8084 }
8085 }   8085 }
8086 static void evh__HG_POSIX_SEM_POST_PRE(ThreadId tid , void *sem )   8086 static void evh__HG_POSIX_SEM_POST_PRE(ThreadId tid , void *sem )
8087 {   8087 {
8088   Thread *thr ;   8088   Thread *thr ;
8089   SO *so ;   8089   SO *so ;
8090   Thr *hbthr ;   8090   Thr *hbthr ;
8091     8091  
8092   {   8092   {
8093   thr = map_threads_maybe_lookup(tid);   8093   thr = map_threads_maybe_lookup(tid);
8094   if (thr) {   8094   if (thr) {
8095     8095  
8096   } else {   8096   } else {
8097     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8097     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8098                         (Char const   *)"hg_main.c", 2587,   8098                         (Char const   *)"hg_main.c", 2587,
8099                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");   8099                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");
8100   }   8100   }
8101   hbthr = thr->hbthr;   8101   hbthr = thr->hbthr;
8102   if (hbthr) {   8102   if (hbthr) {
8103     8103  
8104   } else {   8104   } else {
8105     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   8105     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
8106                         (Char const   *)"hg_main.c", 2592,   8106                         (Char const   *)"hg_main.c", 2592,
8107                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");   8107                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");
8108   }   8108   }
8109   so = libhb_so_alloc();   8109   so = libhb_so_alloc();
8110   libhb_so_send(hbthr, so, (Bool )1);   8110   libhb_so_send(hbthr, so, (Bool )1);
8111   push_SO_for_sem(sem, so);   8111   push_SO_for_sem(sem, so);
8112   return;   8112   return;
8113 }   8113 }
8114 }   8114 }
8115 static void evh__HG_POSIX_SEM_WAIT_POST(ThreadId tid , void *sem )   8115 static void evh__HG_POSIX_SEM_WAIT_POST(ThreadId tid , void *sem )
8116 {   8116 {
8117   Thread *thr ;   8117   Thread *thr ;
8118   SO *so ;   8118   SO *so ;
8119   Thr *hbthr ;   8119   Thr *hbthr ;
8120     8120  
8121   {   8121   {
8122   thr = map_threads_maybe_lookup(tid);   8122   thr = map_threads_maybe_lookup(tid);
8123   if (thr) {   8123   if (thr) {
8124     8124  
8125   } else {   8125   } else {
8126     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8126     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8127                         (Char const   *)"hg_main.c", 2615,   8127                         (Char const   *)"hg_main.c", 2615,
8128                         (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");   8128                         (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");
8129   }   8129   }
8130   so = mb_pop_SO_for_sem(sem);   8130   so = mb_pop_SO_for_sem(sem);
8131   if (so) {   8131   if (so) {
8132     hbthr = thr->hbthr;   8132     hbthr = thr->hbthr;
8133     if (hbthr) {   8133     if (hbthr) {
8134     8134  
8135     } else {   8135     } else {
8136       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   8136       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
8137                           (Char const   *)"hg_main.c", 2623,   8137                           (Char const   *)"hg_main.c", 2623,
8138                           (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");   8138                           (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");
8139     }   8139     }
8140     libhb_so_recv(hbthr, so, (Bool )1);   8140     libhb_so_recv(hbthr, so, (Bool )1);
8141     libhb_so_dealloc(so);   8141     libhb_so_dealloc(so);
8142   } else {   8142   } else {
8143     vgHelgrind_record_error_Misc(thr,   8143     vgHelgrind_record_error_Misc(thr,
8144                                  (HChar *)"Bug in libpthread: sem_wait succeeded on semaphore without prior sem_post");   8144                                  (HChar *)"Bug in libpthread: sem_wait succeeded on semaphore without prior sem_post");
8145   }   8145   }
8146   return;   8146   return;
8147 }   8147 }
8148 }   8148 }
8149 static Bar *new_Bar(void)   8149 static Bar *new_Bar(void)
8150 {   8150 {
8151   Bar *bar ;   8151   Bar *bar ;
8152   void *tmp ;   8152   void *tmp ;
8153     8153  
8154   {   8154   {
8155   tmp = vgHelgrind_zalloc((HChar *)"hg.nB.1 (new_Bar)", (SizeT )sizeof(Bar ));   8155   tmp = vgHelgrind_zalloc((HChar *)"hg.nB.1 (new_Bar)", (SizeT )sizeof(Bar ));
8156   bar = (Bar *)tmp;   8156   bar = (Bar *)tmp;
8157   if (bar) {   8157   if (bar) {
8158     8158  
8159   } else {   8159   } else {
8160     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8160     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8161                         (Char const   *)"hg_main.c", 2653,   8161                         (Char const   *)"hg_main.c", 2653,
8162                         (Char const   *)"new_Bar", "");   8162                         (Char const   *)"new_Bar", "");
8163   }   8163   }
8164   if ((int )bar->initted == 0) {   8164   if ((int )bar->initted == 0) {
8165     8165  
8166   } else {   8166   } else {
8167     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted == False",   8167     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted == False",
8168                         (Char const   *)"hg_main.c", 2655,   8168                         (Char const   *)"hg_main.c", 2655,
8169                         (Char const   *)"new_Bar", "");   8169                         (Char const   *)"new_Bar", "");
8170   }   8170   }
8171   return (bar);   8171   return (bar);
8172 }   8172 }
8173 }   8173 }
8174 static void delete_Bar(Bar *bar )   8174 static void delete_Bar(Bar *bar )
8175 {   8175 {
8176     8176  
8177     8177  
8178   {   8178   {
8179   if (bar) {   8179   if (bar) {
8180     8180  
8181   } else {   8181   } else {
8182     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8182     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8183                         (Char const   *)"hg_main.c", 2660,   8183                         (Char const   *)"hg_main.c", 2660,
8184                         (Char const   *)"delete_Bar", "");   8184                         (Char const   *)"delete_Bar", "");
8185   }   8185   }
8186   if (bar->waiting) {   8186   if (bar->waiting) {
8187     vgPlain_deleteXA(bar->waiting);   8187     vgPlain_deleteXA(bar->waiting);
8188   } else {   8188   } else {
8189     8189  
8190   }   8190   }
8191   vgHelgrind_free((void *)bar);   8191   vgHelgrind_free((void *)bar);
8192   return;   8192   return;
8193 }   8193 }
8194 }   8194 }
8195 static WordFM *map_barrier_to_Bar  =    (WordFM *)((void *)0);   8195 static WordFM *map_barrier_to_Bar  =    (WordFM *)((void *)0);
8196 static void map_barrier_to_Bar_INIT(void)   8196 static void map_barrier_to_Bar_INIT(void)
8197 {   8197 {
8198   long tmp ;   8198   long tmp ;
8199     8199  
8200   {   8200   {
8201   tmp = __builtin_expect((long )((unsigned int )map_barrier_to_Bar == (unsigned int )((void *)0)),   8201   tmp = __builtin_expect((long )((unsigned int )map_barrier_to_Bar == (unsigned int )((void *)0)),
8202                          0L);   8202                          0L);
8203   if (tmp) {   8203   if (tmp) {
8204     map_barrier_to_Bar = vgPlain_newFM(& vgHelgrind_zalloc,   8204     map_barrier_to_Bar = vgPlain_newFM(& vgHelgrind_zalloc,
8205                                        (HChar *)"hg.mbtBI.1", & vgHelgrind_free,   8205                                        (HChar *)"hg.mbtBI.1", & vgHelgrind_free,
8206                                        (Word (*)(UWord  , UWord  ))((void *)0));   8206                                        (Word (*)(UWord  , UWord  ))((void *)0));
8207     if ((unsigned int )map_barrier_to_Bar != (unsigned int )((void *)0)) {   8207     if ((unsigned int )map_barrier_to_Bar != (unsigned int )((void *)0)) {
8208     8208  
8209     } else {   8209     } else {
8210       vgPlain_assert_fail((Bool )0,   8210       vgPlain_assert_fail((Bool )0,
8211                           (Char const   *)"map_barrier_to_Bar != NULL",   8211                           (Char const   *)"map_barrier_to_Bar != NULL",
8212                           (Char const   *)"hg_main.c", 2675,   8212                           (Char const   *)"hg_main.c", 2675,
8213                           (Char const   *)"map_barrier_to_Bar_INIT", "");   8213                           (Char const   *)"map_barrier_to_Bar_INIT", "");
8214     }   8214     }
8215   } else {   8215   } else {
8216     8216  
8217   }   8217   }
8218   return;   8218   return;
8219 }   8219 }
8220 }   8220 }
8221 static Bar *map_barrier_to_Bar_lookup_or_alloc(void *barrier )   8221 static Bar *map_barrier_to_Bar_lookup_or_alloc(void *barrier )
8222 {   8222 {
8223   UWord key ;   8223   UWord key ;
8224   UWord val ;   8224   UWord val ;
8225   Bar *bar ;   8225   Bar *bar ;
8226   Bar *tmp ;   8226   Bar *tmp ;
8227   Bool tmp___0 ;   8227   Bool tmp___0 ;
8228     8228  
8229   {   8229   {
8230   map_barrier_to_Bar_INIT();   8230   map_barrier_to_Bar_INIT();
8231   tmp___0 = vgPlain_lookupFM(map_barrier_to_Bar, & key, & val, (UWord )barrier);   8231   tmp___0 = vgPlain_lookupFM(map_barrier_to_Bar, & key, & val, (UWord )barrier);
8232   if (tmp___0) {   8232   if (tmp___0) {
8233     if (key == (UWord )barrier) {   8233     if (key == (UWord )barrier) {
8234     8234  
8235     } else {   8235     } else {
8236       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)barrier",   8236       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)barrier",
8237                           (Char const   *)"hg_main.c", 2683,   8237                           (Char const   *)"hg_main.c", 2683,
8238                           (Char const   *)"map_barrier_to_Bar_lookup_or_alloc",   8238                           (Char const   *)"map_barrier_to_Bar_lookup_or_alloc",
8239                           "");   8239                           "");
8240     }   8240     }
8241     return ((Bar *)val);   8241     return ((Bar *)val);
8242   } else {   8242   } else {
8243     tmp = new_Bar();   8243     tmp = new_Bar();
8244     bar = tmp;   8244     bar = tmp;
8245     vgPlain_addToFM(map_barrier_to_Bar, (UWord )barrier, (UWord )bar);   8245     vgPlain_addToFM(map_barrier_to_Bar, (UWord )barrier, (UWord )bar);
8246     return (bar);   8246     return (bar);
8247   }   8247   }
8248 }   8248 }
8249 }   8249 }
8250 static void map_barrier_to_Bar_delete(void *barrier )   8250 static void map_barrier_to_Bar_delete(void *barrier )
8251 {   8251 {
8252   UWord keyW ;   8252   UWord keyW ;
8253   UWord valW ;   8253   UWord valW ;
8254   Bar *bar ;   8254   Bar *bar ;
8255   Bool tmp ;   8255   Bool tmp ;
8256     8256  
8257   {   8257   {
8258   map_barrier_to_Bar_INIT();   8258   map_barrier_to_Bar_INIT();
8259   tmp = vgPlain_delFromFM(map_barrier_to_Bar, & keyW, & valW, (UWord )barrier);   8259   tmp = vgPlain_delFromFM(map_barrier_to_Bar, & keyW, & valW, (UWord )barrier);
8260   if (tmp) {   8260   if (tmp) {
8261     bar = (Bar *)valW;   8261     bar = (Bar *)valW;
8262     if (keyW == (UWord )barrier) {   8262     if (keyW == (UWord )barrier) {
8263     8263  
8264     } else {   8264     } else {
8265       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)barrier",   8265       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)barrier",
8266                           (Char const   *)"hg_main.c", 2697,   8266                           (Char const   *)"hg_main.c", 2697,
8267                           (Char const   *)"map_barrier_to_Bar_delete", "");   8267                           (Char const   *)"map_barrier_to_Bar_delete", "");
8268     }   8268     }
8269     delete_Bar(bar);   8269     delete_Bar(bar);
8270   } else {   8270   } else {
8271     8271  
8272   }   8272   }
8273   return;   8273   return;
8274 }   8274 }
8275 }   8275 }
8276 static void evh__HG_PTHREAD_BARRIER_INIT_PRE(ThreadId tid , void *barrier ,   8276 static void evh__HG_PTHREAD_BARRIER_INIT_PRE(ThreadId tid , void *barrier ,
8277                                              UWord count , UWord resizable )   8277                                              UWord count , UWord resizable )
8278 {   8278 {
8279   Thread *thr ;   8279   Thread *thr ;
8280   Bar *bar ;   8280   Bar *bar ;
8281   Word tmp ;   8281   Word tmp ;
8282   Word tmp___0 ;   8282   Word tmp___0 ;
8283   Word tmp___1 ;   8283   Word tmp___1 ;
8284     8284  
8285   {   8285   {
8286   thr = map_threads_maybe_lookup(tid);   8286   thr = map_threads_maybe_lookup(tid);
8287   if (thr) {   8287   if (thr) {
8288     8288  
8289   } else {   8289   } else {
8290     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8290     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8291                         (Char const   *)"hg_main.c", 2717,   8291                         (Char const   *)"hg_main.c", 2717,
8292                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8292                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8293   }   8293   }
8294   if (count == 0UL) {   8294   if (count == 0UL) {
8295     vgHelgrind_record_error_Misc(thr,   8295     vgHelgrind_record_error_Misc(thr,
8296                                  (HChar *)"pthread_barrier_init: \'count\' argument is zero");   8296                                  (HChar *)"pthread_barrier_init: \'count\' argument is zero");
8297   } else {   8297   } else {
8298     8298  
8299   }   8299   }
8300   if (resizable != 0UL) {   8300   if (resizable != 0UL) {
8301     if (resizable != 1UL) {   8301     if (resizable != 1UL) {
8302       vgHelgrind_record_error_Misc(thr,   8302       vgHelgrind_record_error_Misc(thr,
8303                                    (HChar *)"pthread_barrier_init: invalid \'resizable\' argument");   8303                                    (HChar *)"pthread_barrier_init: invalid \'resizable\' argument");
8304     } else {   8304     } else {
8305     8305  
8306     }   8306     }
8307   } else {   8307   } else {
8308     8308  
8309   }   8309   }
8310   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8310   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8311   if (bar) {   8311   if (bar) {
8312     8312  
8313   } else {   8313   } else {
8314     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8314     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8315                         (Char const   *)"hg_main.c", 2732,   8315                         (Char const   *)"hg_main.c", 2732,
8316                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8316                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8317   }   8317   }
8318   if (bar->initted) {   8318   if (bar->initted) {
8319     vgHelgrind_record_error_Misc(thr,   8319     vgHelgrind_record_error_Misc(thr,
8320                                  (HChar *)"pthread_barrier_init: barrier is already initialised");   8320                                  (HChar *)"pthread_barrier_init: barrier is already initialised");
8321   } else {   8321   } else {
8322     8322  
8323   }   8323   }
8324   if (bar->waiting) {   8324   if (bar->waiting) {
8325     tmp___0 = vgPlain_sizeXA(bar->waiting);   8325     tmp___0 = vgPlain_sizeXA(bar->waiting);
8326     if (tmp___0 > 0L) {   8326     if (tmp___0 > 0L) {
8327       if (bar->initted) {   8327       if (bar->initted) {
8328     8328  
8329       } else {   8329       } else {
8330         vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted",   8330         vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted",
8331                             (Char const   *)"hg_main.c", 2741,   8331                             (Char const   *)"hg_main.c", 2741,
8332                             (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE",   8332                             (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE",
8333                             "");   8333                             "");
8334       }   8334       }
8335       vgHelgrind_record_error_Misc(thr,   8335       vgHelgrind_record_error_Misc(thr,
8336                                    (HChar *)"pthread_barrier_init: threads are waiting at barrier");   8336                                    (HChar *)"pthread_barrier_init: threads are waiting at barrier");
8337       tmp = vgPlain_sizeXA(bar->waiting);   8337       tmp = vgPlain_sizeXA(bar->waiting);
8338       vgPlain_dropTailXA(bar->waiting, tmp);   8338       vgPlain_dropTailXA(bar->waiting, tmp);
8339     } else {   8339     } else {
8340     8340  
8341     }   8341     }
8342   } else {   8342   } else {
8343     8343  
8344   }   8344   }
8345   if (! bar->waiting) {   8345   if (! bar->waiting) {
8346     bar->waiting = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.eHPBIP.1",   8346     bar->waiting = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.eHPBIP.1",
8347                                  & vgHelgrind_free, (Word )sizeof(Thread *));   8347                                  & vgHelgrind_free, (Word )sizeof(Thread *));
8348   } else {   8348   } else {
8349     8349  
8350   }   8350   }
8351   if (bar->waiting) {   8351   if (bar->waiting) {
8352     8352  
8353   } else {   8353   } else {
8354     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8354     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8355                         (Char const   *)"hg_main.c", 2752,   8355                         (Char const   *)"hg_main.c", 2752,
8356                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8356                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8357   }   8357   }
8358   tmp___1 = vgPlain_sizeXA(bar->waiting);   8358   tmp___1 = vgPlain_sizeXA(bar->waiting);
8359   if (tmp___1 == 0L) {   8359   if (tmp___1 == 0L) {
8360     8360  
8361   } else {   8361   } else {
8362     vgPlain_assert_fail((Bool )0,   8362     vgPlain_assert_fail((Bool )0,
8363                         (Char const   *)"VG_(sizeXA)(bar->waiting) == 0",   8363                         (Char const   *)"VG_(sizeXA)(bar->waiting) == 0",
8364                         (Char const   *)"hg_main.c", 2753,   8364                         (Char const   *)"hg_main.c", 2753,
8365                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8365                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8366   }   8366   }
8367   bar->initted = (Bool )1;   8367   bar->initted = (Bool )1;
8368   if (resizable == 1UL) {   8368   if (resizable == 1UL) {
8369     bar->resizable = (Bool )1;   8369     bar->resizable = (Bool )1;
8370   } else {   8370   } else {
8371     bar->resizable = (Bool )0;   8371     bar->resizable = (Bool )0;
8372   }   8372   }
8373   bar->size = count;   8373   bar->size = count;
8374   return;   8374   return;
8375 }   8375 }
8376 }   8376 }
8377 static void evh__HG_PTHREAD_BARRIER_DESTROY_PRE(ThreadId tid , void *barrier )   8377 static void evh__HG_PTHREAD_BARRIER_DESTROY_PRE(ThreadId tid , void *barrier )
8378 {   8378 {
8379   Thread *thr ;   8379   Thread *thr ;
8380   Bar *bar ;   8380   Bar *bar ;
8381   Word tmp ;   8381   Word tmp ;
8382     8382  
8383   {   8383   {
8384   thr = map_threads_maybe_lookup(tid);   8384   thr = map_threads_maybe_lookup(tid);
8385   if (thr) {   8385   if (thr) {
8386     8386  
8387   } else {   8387   } else {
8388     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8388     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8389                         (Char const   *)"hg_main.c", 2775,   8389                         (Char const   *)"hg_main.c", 2775,
8390                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",   8390                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",
8391                         "");   8391                         "");
8392   }   8392   }
8393   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8393   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8394   if (bar) {   8394   if (bar) {
8395     8395  
8396   } else {   8396   } else {
8397     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8397     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8398                         (Char const   *)"hg_main.c", 2778,   8398                         (Char const   *)"hg_main.c", 2778,
8399                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",   8399                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",
8400                         "");   8400                         "");
8401   }   8401   }
8402   if (! bar->initted) {   8402   if (! bar->initted) {
8403     vgHelgrind_record_error_Misc(thr,   8403     vgHelgrind_record_error_Misc(thr,
8404                                  (HChar *)"pthread_barrier_destroy: barrier was never initialised");   8404                                  (HChar *)"pthread_barrier_destroy: barrier was never initialised");
8405   } else {   8405   } else {
8406     8406  
8407   }   8407   }
8408   if (bar->initted) {   8408   if (bar->initted) {
8409     if (bar->waiting) {   8409     if (bar->waiting) {
8410       tmp = vgPlain_sizeXA(bar->waiting);   8410       tmp = vgPlain_sizeXA(bar->waiting);
8411       if (tmp > 0L) {   8411       if (tmp > 0L) {
8412         vgHelgrind_record_error_Misc(thr,   8412         vgHelgrind_record_error_Misc(thr,
8413                                      (HChar *)"pthread_barrier_destroy: threads are waiting at barrier");   8413                                      (HChar *)"pthread_barrier_destroy: threads are waiting at barrier");
8414       } else {   8414       } else {
8415     8415  
8416       }   8416       }
8417     } else {   8417     } else {
8418     8418  
8419     }   8419     }
8420   } else {   8420   } else {
8421     8421  
8422   }   8422   }
8423   map_barrier_to_Bar_delete(barrier);   8423   map_barrier_to_Bar_delete(barrier);
8424   return;   8424   return;
8425 }   8425 }
8426 }   8426 }
8427 static void do_barrier_cross_sync_and_empty(Bar *bar )   8427 static void do_barrier_cross_sync_and_empty(Bar *bar )
8428 {   8428 {
8429   UWord i ;   8429   UWord i ;
8430   SO *so ;   8430   SO *so ;
8431   SO *tmp ;   8431   SO *tmp ;
8432   Word tmp___0 ;   8432   Word tmp___0 ;
8433   Thread *t ;   8433   Thread *t ;
8434   void *tmp___1 ;   8434   void *tmp___1 ;
8435   Thr *hbthr ;   8435   Thr *hbthr ;
8436   Thread *t___0 ;   8436   Thread *t___0 ;
8437   void *tmp___2 ;   8437   void *tmp___2 ;
8438   Thr *hbthr___0 ;   8438   Thr *hbthr___0 ;
8439   Word tmp___3 ;   8439   Word tmp___3 ;
8440     8440  
8441   {   8441   {
8442   tmp = libhb_so_alloc();   8442   tmp = libhb_so_alloc();
8443   so = tmp;   8443   so = tmp;
8444   if (bar->waiting) {   8444   if (bar->waiting) {
8445     8445  
8446   } else {   8446   } else {
8447     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8447     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8448                         (Char const   *)"hg_main.c", 2816,   8448                         (Char const   *)"hg_main.c", 2816,
8449                         (Char const   *)"do_barrier_cross_sync_and_empty", "");   8449                         (Char const   *)"do_barrier_cross_sync_and_empty", "");
8450   }   8450   }
8451   tmp___0 = vgPlain_sizeXA(bar->waiting);   8451   tmp___0 = vgPlain_sizeXA(bar->waiting);
8452   if ((UWord )tmp___0 == bar->size) {   8452   if ((UWord )tmp___0 == bar->size) {
8453     8453  
8454   } else {   8454   } else {
8455     vgPlain_assert_fail((Bool )0,   8455     vgPlain_assert_fail((Bool )0,
8456                         (Char const   *)"VG_(sizeXA)(bar->waiting) == bar->size",   8456                         (Char const   *)"VG_(sizeXA)(bar->waiting) == bar->size",
8457                         (Char const   *)"hg_main.c", 2817,   8457                         (Char const   *)"hg_main.c", 2817,
8458                         (Char const   *)"do_barrier_cross_sync_and_empty", "");   8458                         (Char const   *)"do_barrier_cross_sync_and_empty", "");
8459   }   8459   }
8460   i = (UWord )0;   8460   i = (UWord )0;
8461   while (i < bar->size) {   8461   while (i < bar->size) {
8462     tmp___1 = vgPlain_indexXA(bar->waiting, (Word )i);   8462     tmp___1 = vgPlain_indexXA(bar->waiting, (Word )i);
8463     t = *((Thread **)tmp___1);   8463     t = *((Thread **)tmp___1);
8464     hbthr = t->hbthr;   8464     hbthr = t->hbthr;
8465     libhb_so_send(hbthr, so, (Bool )0);   8465     libhb_so_send(hbthr, so, (Bool )0);
8466     i ++;   8466     i ++;
8467   }   8467   }
8468   i = (UWord )0;   8468   i = (UWord )0;
8469   while (i < bar->size) {   8469   while (i < bar->size) {
8470     tmp___2 = vgPlain_indexXA(bar->waiting, (Word )i);   8470     tmp___2 = vgPlain_indexXA(bar->waiting, (Word )i);
8471     t___0 = *((Thread **)tmp___2);   8471     t___0 = *((Thread **)tmp___2);
8472     hbthr___0 = t___0->hbthr;   8472     hbthr___0 = t___0->hbthr;
8473     libhb_so_recv(hbthr___0, so, (Bool )1);   8473     libhb_so_recv(hbthr___0, so, (Bool )1);
8474     i ++;   8474     i ++;
8475   }   8475   }
8476   tmp___3 = vgPlain_sizeXA(bar->waiting);   8476   tmp___3 = vgPlain_sizeXA(bar->waiting);
8477   vgPlain_dropTailXA(bar->waiting, tmp___3);   8477   vgPlain_dropTailXA(bar->waiting, tmp___3);
8478   libhb_so_dealloc(so);   8478   libhb_so_dealloc(so);
8479   return;   8479   return;
8480 }   8480 }
8481 }   8481 }
8482 static void evh__HG_PTHREAD_BARRIER_WAIT_PRE(ThreadId tid , void *barrier )   8482 static void evh__HG_PTHREAD_BARRIER_WAIT_PRE(ThreadId tid , void *barrier )
8483 {   8483 {
8484   Thread *thr ;   8484   Thread *thr ;
8485   Bar *bar ;   8485   Bar *bar ;
8486   UWord present ;   8486   UWord present ;
8487   Word tmp ;   8487   Word tmp ;
8488     8488  
8489   {   8489   {
8490   thr = map_threads_maybe_lookup(tid);   8490   thr = map_threads_maybe_lookup(tid);
8491   if (thr) {   8491   if (thr) {
8492     8492  
8493   } else {   8493   } else {
8494     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8494     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8495                         (Char const   *)"hg_main.c", 2894,   8495                         (Char const   *)"hg_main.c", 2894,
8496                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8496                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8497   }   8497   }
8498   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8498   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8499   if (bar) {   8499   if (bar) {
8500     8500  
8501   } else {   8501   } else {
8502     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8502     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8503                         (Char const   *)"hg_main.c", 2897,   8503                         (Char const   *)"hg_main.c", 2897,
8504                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8504                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8505   }   8505   }
8506   if (! bar->initted) {   8506   if (! bar->initted) {
8507     vgHelgrind_record_error_Misc(thr,   8507     vgHelgrind_record_error_Misc(thr,
8508                                  (HChar *)"pthread_barrier_wait: barrier is uninitialised");   8508                                  (HChar *)"pthread_barrier_wait: barrier is uninitialised");
8509     return;   8509     return;
8510   } else {   8510   } else {
8511     8511  
8512   }   8512   }
8513   if (bar->size > 0UL) {   8513   if (bar->size > 0UL) {
8514     8514  
8515   } else {   8515   } else {
8516     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",   8516     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",
8517                         (Char const   *)"hg_main.c", 2907,   8517                         (Char const   *)"hg_main.c", 2907,
8518                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8518                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8519   }   8519   }
8520   if (bar->waiting) {   8520   if (bar->waiting) {
8521     8521  
8522   } else {   8522   } else {
8523     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8523     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8524                         (Char const   *)"hg_main.c", 2908,   8524                         (Char const   *)"hg_main.c", 2908,
8525                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8525                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8526   }   8526   }
8527   vgPlain_addToXA(bar->waiting, (void *)(& thr));   8527   vgPlain_addToXA(bar->waiting, (void *)(& thr));
8528   tmp = vgPlain_sizeXA(bar->waiting);   8528   tmp = vgPlain_sizeXA(bar->waiting);
8529   present = (UWord )tmp;   8529   present = (UWord )tmp;
8530   if (present > 0UL) {   8530   if (present > 0UL) {
8531     if (present <= bar->size) {   8531     if (present <= bar->size) {
8532     8532  
8533     } else {   8533     } else {
8534       vgPlain_assert_fail((Bool )0,   8534       vgPlain_assert_fail((Bool )0,
8535                           (Char const   *)"present > 0 && present <= bar->size",   8535                           (Char const   *)"present > 0 && present <= bar->size",
8536                           (Char const   *)"hg_main.c", 2914,   8536                           (Char const   *)"hg_main.c", 2914,
8537                           (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8537                           (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8538     }   8538     }
8539   } else {   8539   } else {
8540     vgPlain_assert_fail((Bool )0,   8540     vgPlain_assert_fail((Bool )0,
8541                         (Char const   *)"present > 0 && present <= bar->size",   8541                         (Char const   *)"present > 0 && present <= bar->size",
8542                         (Char const   *)"hg_main.c", 2914,   8542                         (Char const   *)"hg_main.c", 2914,
8543                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8543                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8544   }   8544   }
8545   if (present < bar->size) {   8545   if (present < bar->size) {
8546     return;   8546     return;
8547   } else {   8547   } else {
8548     8548  
8549   }   8549   }
8550   do_barrier_cross_sync_and_empty(bar);   8550   do_barrier_cross_sync_and_empty(bar);
8551   return;   8551   return;
8552 }   8552 }
8553 }   8553 }
8554 static void evh__HG_PTHREAD_BARRIER_RESIZE_PRE(ThreadId tid , void *barrier ,   8554 static void evh__HG_PTHREAD_BARRIER_RESIZE_PRE(ThreadId tid , void *barrier ,
8555                                                UWord newcount )   8555                                                UWord newcount )
8556 {   8556 {
8557   Thread *thr ;   8557   Thread *thr ;
8558   Bar *bar ;   8558   Bar *bar ;
8559   UWord present ;   8559   UWord present ;
8560   Word tmp ;   8560   Word tmp ;
8561     8561  
8562   {   8562   {
8563   thr = map_threads_maybe_lookup(tid);   8563   thr = map_threads_maybe_lookup(tid);
8564   if (thr) {   8564   if (thr) {
8565     8565  
8566   } else {   8566   } else {
8567     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8567     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8568                         (Char const   *)"hg_main.c", 2937,   8568                         (Char const   *)"hg_main.c", 2937,
8569                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8569                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8570   }   8570   }
8571   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8571   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8572   if (bar) {   8572   if (bar) {
8573     8573  
8574   } else {   8574   } else {
8575     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8575     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8576                         (Char const   *)"hg_main.c", 2940,   8576                         (Char const   *)"hg_main.c", 2940,
8577                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8577                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8578   }   8578   }
8579   if (! bar->initted) {   8579   if (! bar->initted) {
8580     vgHelgrind_record_error_Misc(thr,   8580     vgHelgrind_record_error_Misc(thr,
8581                                  (HChar *)"pthread_barrier_resize: barrier is uninitialised");   8581                                  (HChar *)"pthread_barrier_resize: barrier is uninitialised");
8582     return;   8582     return;
8583   } else {   8583   } else {
8584     8584  
8585   }   8585   }
8586   if (! bar->resizable) {   8586   if (! bar->resizable) {
8587     vgHelgrind_record_error_Misc(thr,   8587     vgHelgrind_record_error_Misc(thr,
8588                                  (HChar *)"pthread_barrier_resize: barrier is may not be resized");   8588                                  (HChar *)"pthread_barrier_resize: barrier is may not be resized");
8589     return;   8589     return;
8590   } else {   8590   } else {
8591     8591  
8592   }   8592   }
8593   if (newcount == 0UL) {   8593   if (newcount == 0UL) {
8594     vgHelgrind_record_error_Misc(thr,   8594     vgHelgrind_record_error_Misc(thr,
8595                                  (HChar *)"pthread_barrier_resize: \'newcount\' argument is zero");   8595                                  (HChar *)"pthread_barrier_resize: \'newcount\' argument is zero");
8596     return;   8596     return;
8597   } else {   8597   } else {
8598     8598  
8599   }   8599   }
8600   if (bar->size > 0UL) {   8600   if (bar->size > 0UL) {
8601     8601  
8602   } else {   8602   } else {
8603     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",   8603     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",
8604                         (Char const   *)"hg_main.c", 2964,   8604                         (Char const   *)"hg_main.c", 2964,
8605                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8605                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8606   }   8606   }
8607   if (bar->waiting) {   8607   if (bar->waiting) {
8608     8608  
8609   } else {   8609   } else {
8610     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8610     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8611                         (Char const   *)"hg_main.c", 2965,   8611                         (Char const   *)"hg_main.c", 2965,
8612                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8612                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8613   }   8613   }
8614   if (newcount > 0UL) {   8614   if (newcount > 0UL) {
8615     8615  
8616   } else {   8616   } else {
8617     vgPlain_assert_fail((Bool )0, (Char const   *)"newcount > 0",   8617     vgPlain_assert_fail((Bool )0, (Char const   *)"newcount > 0",
8618                         (Char const   *)"hg_main.c", 2967,   8618                         (Char const   *)"hg_main.c", 2967,
8619                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8619                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8620   }   8620   }
8621   if (newcount >= bar->size) {   8621   if (newcount >= bar->size) {
8622     bar->size = newcount;   8622     bar->size = newcount;
8623   } else {   8623   } else {
8624     tmp = vgPlain_sizeXA(bar->waiting);   8624     tmp = vgPlain_sizeXA(bar->waiting);
8625     present = (UWord )tmp;   8625     present = (UWord )tmp;
8626     if (present >= 0UL) {   8626     if (present >= 0UL) {
8627       if (present <= bar->size) {   8627       if (present <= bar->size) {
8628     8628  
8629       } else {   8629       } else {
8630         vgPlain_assert_fail((Bool )0,   8630         vgPlain_assert_fail((Bool )0,
8631                             (Char const   *)"present >= 0 && present <= bar->size",   8631                             (Char const   *)"present >= 0 && present <= bar->size",
8632                             (Char const   *)"hg_main.c", 2980,   8632                             (Char const   *)"hg_main.c", 2980,
8633                             (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",   8633                             (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",
8634                             "");   8634                             "");
8635       }   8635       }
8636     } else {   8636     } else {
8637       vgPlain_assert_fail((Bool )0,   8637       vgPlain_assert_fail((Bool )0,
8638                           (Char const   *)"present >= 0 && present <= bar->size",   8638                           (Char const   *)"present >= 0 && present <= bar->size",
8639                           (Char const   *)"hg_main.c", 2980,   8639                           (Char const   *)"hg_main.c", 2980,
8640                           (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",   8640                           (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",
8641                           "");   8641                           "");
8642     }   8642     }
8643     if (newcount <= present) {   8643     if (newcount <= present) {
8644       bar->size = present;   8644       bar->size = present;
8645       do_barrier_cross_sync_and_empty(bar);   8645       do_barrier_cross_sync_and_empty(bar);
8646     } else {   8646     } else {
8647     8647  
8648     }   8648     }
8649     bar->size = newcount;   8649     bar->size = newcount;
8650   }   8650   }
8651   return;   8651   return;
8652 }   8652 }
8653 }   8653 }
8654 static WordFM *map_usertag_to_SO  =    (WordFM *)((void *)0);   8654 static WordFM *map_usertag_to_SO  =    (WordFM *)((void *)0);
8655 static void map_usertag_to_SO_INIT(void)   8655 static void map_usertag_to_SO_INIT(void)
8656 {   8656 {
8657   long tmp ;   8657   long tmp ;
8658     8658  
8659   {   8659   {
8660   tmp = __builtin_expect((long )((unsigned int )map_usertag_to_SO == (unsigned int )((void *)0)),   8660   tmp = __builtin_expect((long )((unsigned int )map_usertag_to_SO == (unsigned int )((void *)0)),
8661                          0L);   8661                          0L);
8662   if (tmp) {   8662   if (tmp) {
8663     map_usertag_to_SO = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.mutS.1",   8663     map_usertag_to_SO = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.mutS.1",
8664                                       & vgHelgrind_free,   8664                                       & vgHelgrind_free,
8665                                       (Word (*)(UWord  , UWord  ))((void *)0));   8665                                       (Word (*)(UWord  , UWord  ))((void *)0));
8666     if ((unsigned int )map_usertag_to_SO != (unsigned int )((void *)0)) {   8666     if ((unsigned int )map_usertag_to_SO != (unsigned int )((void *)0)) {
8667     8667  
8668     } else {   8668     } else {
8669       vgPlain_assert_fail((Bool )0, (Char const   *)"map_usertag_to_SO != NULL",   8669       vgPlain_assert_fail((Bool )0, (Char const   *)"map_usertag_to_SO != NULL",
8670                           (Char const   *)"hg_main.c", 3007,   8670                           (Char const   *)"hg_main.c", 3007,
8671                           (Char const   *)"map_usertag_to_SO_INIT", "");   8671                           (Char const   *)"map_usertag_to_SO_INIT", "");
8672     }   8672     }
8673   } else {   8673   } else {
8674     8674  
8675   }   8675   }
8676   return;   8676   return;
8677 }   8677 }
8678 }   8678 }
8679 static SO *map_usertag_to_SO_lookup_or_alloc(UWord usertag )   8679 static SO *map_usertag_to_SO_lookup_or_alloc(UWord usertag )
8680 {   8680 {
8681   UWord key ;   8681   UWord key ;
8682   UWord val ;   8682   UWord val ;
8683   SO *so ;   8683   SO *so ;
8684   SO *tmp ;   8684   SO *tmp ;
8685   Bool tmp___0 ;   8685   Bool tmp___0 ;
8686     8686  
8687   {   8687   {
8688   map_usertag_to_SO_INIT();   8688   map_usertag_to_SO_INIT();
8689   tmp___0 = vgPlain_lookupFM(map_usertag_to_SO, & key, & val, usertag);   8689   tmp___0 = vgPlain_lookupFM(map_usertag_to_SO, & key, & val, usertag);
8690   if (tmp___0) {   8690   if (tmp___0) {
8691     if (key == usertag) {   8691     if (key == usertag) {
8692     8692  
8693     } else {   8693     } else {
8694       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)usertag",   8694       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)usertag",
8695                           (Char const   *)"hg_main.c", 3015,   8695                           (Char const   *)"hg_main.c", 3015,
8696                           (Char const   *)"map_usertag_to_SO_lookup_or_alloc",   8696                           (Char const   *)"map_usertag_to_SO_lookup_or_alloc",
8697                           "");   8697                           "");
8698     }   8698     }
8699     return ((SO *)val);   8699     return ((SO *)val);
8700   } else {   8700   } else {
8701     tmp = libhb_so_alloc();   8701     tmp = libhb_so_alloc();
8702     so = tmp;   8702     so = tmp;
8703     vgPlain_addToFM(map_usertag_to_SO, usertag, (UWord )so);   8703     vgPlain_addToFM(map_usertag_to_SO, usertag, (UWord )so);
8704     return (so);   8704     return (so);
8705   }   8705   }
8706 }   8706 }
8707 }   8707 }
8708 static void evh__HG_USERSO_SEND_PRE(ThreadId tid , UWord usertag )   8708 static void evh__HG_USERSO_SEND_PRE(ThreadId tid , UWord usertag )
8709 {   8709 {
8710   Thread *thr ;   8710   Thread *thr ;
8711   SO *so ;   8711   SO *so ;
8712     8712  
8713   {   8713   {
8714   thr = map_threads_maybe_lookup(tid);   8714   thr = map_threads_maybe_lookup(tid);
8715   if (thr) {   8715   if (thr) {
8716     8716  
8717   } else {   8717   } else {
8718     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8718     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8719                         (Char const   *)"hg_main.c", 3054,   8719                         (Char const   *)"hg_main.c", 3054,
8720                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");   8720                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");
8721   }   8721   }
8722   so = map_usertag_to_SO_lookup_or_alloc(usertag);   8722   so = map_usertag_to_SO_lookup_or_alloc(usertag);
8723   if (so) {   8723   if (so) {
8724     8724  
8725   } else {   8725   } else {
8726     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   8726     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
8727                         (Char const   *)"hg_main.c", 3057,   8727                         (Char const   *)"hg_main.c", 3057,
8728                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");   8728                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");
8729   }   8729   }
8730   libhb_so_send(thr->hbthr, so, (Bool )1);   8730   libhb_so_send(thr->hbthr, so, (Bool )1);
8731   return;   8731   return;
8732 }   8732 }
8733 }   8733 }
8734 static void evh__HG_USERSO_RECV_POST(ThreadId tid , UWord usertag )   8734 static void evh__HG_USERSO_RECV_POST(ThreadId tid , UWord usertag )
8735 {   8735 {
8736   Thread *thr ;   8736   Thread *thr ;
8737   SO *so ;   8737   SO *so ;
8738     8738  
8739   {   8739   {
8740   thr = map_threads_maybe_lookup(tid);   8740   thr = map_threads_maybe_lookup(tid);
8741   if (thr) {   8741   if (thr) {
8742     8742  
8743   } else {   8743   } else {
8744     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8744     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8745                         (Char const   *)"hg_main.c", 3079,   8745                         (Char const   *)"hg_main.c", 3079,
8746                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");   8746                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");
8747   }   8747   }
8748   so = map_usertag_to_SO_lookup_or_alloc(usertag);   8748   so = map_usertag_to_SO_lookup_or_alloc(usertag);
8749   if (so) {   8749   if (so) {
8750     8750  
8751   } else {   8751   } else {
8752     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   8752     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
8753                         (Char const   *)"hg_main.c", 3082,   8753                         (Char const   *)"hg_main.c", 3082,
8754                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");   8754                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");
8755   }   8755   }
8756   libhb_so_recv(thr->hbthr, so, (Bool )1);   8756   libhb_so_recv(thr->hbthr, so, (Bool )1);
8757   return;   8757   return;
8758 }   8758 }
8759 }   8759 }
8760 static WordFM *laog  =    (WordFM *)((void *)0);   8760 static WordFM *laog  =    (WordFM *)((void *)0);
8761 static Word cmp_LAOGLinkExposition(UWord llx1W , UWord llx2W )   8761 static Word cmp_LAOGLinkExposition(UWord llx1W , UWord llx2W )
8762 {   8762 {
8763   LAOGLinkExposition *llx1 ;   8763   LAOGLinkExposition *llx1 ;
8764   LAOGLinkExposition *llx2 ;   8764   LAOGLinkExposition *llx2 ;
8765     8765  
8766   {   8766   {
8767   llx1 = (LAOGLinkExposition *)llx1W;   8767   llx1 = (LAOGLinkExposition *)llx1W;
8768   llx2 = (LAOGLinkExposition *)llx2W;   8768   llx2 = (LAOGLinkExposition *)llx2W;
8769   if (llx1->src_ga < llx2->src_ga) {   8769   if (llx1->src_ga < llx2->src_ga) {
8770     return ((Word )-1);   8770     return ((Word )-1);
8771   } else {   8771   } else {
8772     8772  
8773   }   8773   }
8774   if (llx1->src_ga > llx2->src_ga) {   8774   if (llx1->src_ga > llx2->src_ga) {
8775     return ((Word )1);   8775     return ((Word )1);
8776   } else {   8776   } else {
8777     8777  
8778   }   8778   }
8779   if (llx1->dst_ga < llx2->dst_ga) {   8779   if (llx1->dst_ga < llx2->dst_ga) {
8780     return ((Word )-1);   8780     return ((Word )-1);
8781   } else {   8781   } else {
8782     8782  
8783   }   8783   }
8784   if (llx1->dst_ga > llx2->dst_ga) {   8784   if (llx1->dst_ga > llx2->dst_ga) {
8785     return ((Word )1);   8785     return ((Word )1);
8786   } else {   8786   } else {
8787     8787  
8788   }   8788   }
8789   return ((Word )0);   8789   return ((Word )0);
8790 }   8790 }
8791 }   8791 }
8792 static WordFM *laog_exposition  =    (WordFM *)((void *)0);   8792 static WordFM *laog_exposition  =    (WordFM *)((void *)0);
8793 static void ( __attribute__((__noinline__)) laog__init)(void)   8793 static void ( __attribute__((__noinline__)) laog__init)(void)
8794 {   8794 {
8795     8795  
8796     8796  
8797   {   8797   {
8798   if (! laog) {   8798   if (! laog) {
8799     8799  
8800   } else {   8800   } else {
8801     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog",   8801     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog",
8802                         (Char const   *)"hg_main.c", 3161,   8802                         (Char const   *)"hg_main.c", 3161,
8803                         (Char const   *)"laog__init", "");   8803                         (Char const   *)"laog__init", "");
8804   }   8804   }
8805   if (! laog_exposition) {   8805   if (! laog_exposition) {
8806     8806  
8807   } else {   8807   } else {
8808     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog_exposition",   8808     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog_exposition",
8809                         (Char const   *)"hg_main.c", 3162,   8809                         (Char const   *)"hg_main.c", 3162,
8810                         (Char const   *)"laog__init", "");   8810                         (Char const   *)"laog__init", "");
8811   }   8811   }
8812   if (vgHelgrind_clo_track_lockorders) {   8812   if (vgHelgrind_clo_track_lockorders) {
8813     8813  
8814   } else {   8814   } else {
8815     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(clo_track_lockorders)",   8815     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(clo_track_lockorders)",
8816                         (Char const   *)"hg_main.c", 3163,   8816                         (Char const   *)"hg_main.c", 3163,
8817                         (Char const   *)"laog__init", "");   8817                         (Char const   *)"laog__init", "");
8818   }   8818   }
8819   laog = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.laog__init.1",   8819   laog = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.laog__init.1",
8820                        & vgHelgrind_free,   8820                        & vgHelgrind_free,
8821                        (Word (*)(UWord  , UWord  ))((void *)0));   8821                        (Word (*)(UWord  , UWord  ))((void *)0));
8822   laog_exposition = vgPlain_newFM(& vgHelgrind_zalloc,   8822   laog_exposition = vgPlain_newFM(& vgHelgrind_zalloc,
8823                                   (HChar *)"hg.laog__init.2", & vgHelgrind_free,   8823                                   (HChar *)"hg.laog__init.2", & vgHelgrind_free,
8824                                   & cmp_LAOGLinkExposition);   8824                                   & cmp_LAOGLinkExposition);
8825   if (laog) {   8825   if (laog) {
8826     8826  
8827   } else {   8827   } else {
8828     vgPlain_assert_fail((Bool )0, (Char const   *)"laog",   8828     vgPlain_assert_fail((Bool )0, (Char const   *)"laog",
8829                         (Char const   *)"hg_main.c", 3170,   8829                         (Char const   *)"hg_main.c", 3170,
8830                         (Char const   *)"laog__init", "");   8830                         (Char const   *)"laog__init", "");
8831   }   8831   }
8832   if (laog_exposition) {   8832   if (laog_exposition) {
8833     8833  
8834   } else {   8834   } else {
8835     vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",   8835     vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",
8836                         (Char const   *)"hg_main.c", 3171,   8836                         (Char const   *)"hg_main.c", 3171,
8837                         (Char const   *)"laog__init", "");   8837                         (Char const   *)"laog__init", "");
8838   }   8838   }
8839   return;   8839   return;
8840 }   8840 }
8841 }   8841 }
8842 static void laog__show(Char *who )   8842 static void laog__show(Char *who )
8843 {   8843 {
8844   Word i ;   8844   Word i ;
8845   Word ws_size ;   8845   Word ws_size ;
8846   UWord *ws_words ;   8846   UWord *ws_words ;
8847   Lock *me ;   8847   Lock *me ;
8848   LAOGLinks *links ;   8848   LAOGLinks *links ;
8849   Bool tmp ;   8849   Bool tmp ;
8850     8850  
8851   {   8851   {
8852   vgPlain_printf("laog (requested by %s) {\n", who);   8852   vgPlain_printf("laog (requested by %s) {\n", who);
8853   vgPlain_initIterFM(laog);   8853   vgPlain_initIterFM(laog);
8854   me = (Lock *)((void *)0);   8854   me = (Lock *)((void *)0);
8855   links = (LAOGLinks *)((void *)0);   8855   links = (LAOGLinks *)((void *)0);
8856   while (1) {   8856   while (1) {
8857     tmp = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),   8857     tmp = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),
8858                              (UWord *)((Word *)(& links)));   8858                              (UWord *)((Word *)(& links)));
8859     if (tmp) {   8859     if (tmp) {
8860     8860  
8861     } else {   8861     } else {
8862       break;   8862       break;
8863     }   8863     }
8864     if (me) {   8864     if (me) {
8865     8865  
8866     } else {   8866     } else {
8867       vgPlain_assert_fail((Bool )0, (Char const   *)"me",   8867       vgPlain_assert_fail((Bool )0, (Char const   *)"me",
8868                           (Char const   *)"hg_main.c", 3185,   8868                           (Char const   *)"hg_main.c", 3185,
8869                           (Char const   *)"laog__show", "");   8869                           (Char const   *)"laog__show", "");
8870     }   8870     }
8871     if (links) {   8871     if (links) {
8872     8872  
8873     } else {   8873     } else {
8874       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   8874       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
8875                           (Char const   *)"hg_main.c", 3186,   8875                           (Char const   *)"hg_main.c", 3186,
8876                           (Char const   *)"laog__show", "");   8876                           (Char const   *)"laog__show", "");
8877     }   8877     }
8878     vgPlain_printf("   node %p:\n", me);   8878     vgPlain_printf("   node %p:\n", me);
8879     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   8879     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
8880                             links->inns);   8880                             links->inns);
8881     i = (Word )0;   8881     i = (Word )0;
8882     while (i < ws_size) {   8882     while (i < ws_size) {
8883       vgPlain_printf("      inn %#lx\n", *(ws_words + i));   8883       vgPlain_printf("      inn %#lx\n", *(ws_words + i));
8884       i ++;   8884       i ++;
8885     }   8885     }
8886     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   8886     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
8887                             links->outs);   8887                             links->outs);
8888     i = (Word )0;   8888     i = (Word )0;
8889     while (i < ws_size) {   8889     while (i < ws_size) {
8890       vgPlain_printf("      out %#lx\n", *(ws_words + i));   8890       vgPlain_printf("      out %#lx\n", *(ws_words + i));
8891       i ++;   8891       i ++;
8892     }   8892     }
8893     me = (Lock *)((void *)0);   8893     me = (Lock *)((void *)0);
8894     links = (LAOGLinks *)((void *)0);   8894     links = (LAOGLinks *)((void *)0);
8895   }   8895   }
8896   vgPlain_doneIterFM(laog);   8896   vgPlain_doneIterFM(laog);
8897   vgPlain_printf("}\n");   8897   vgPlain_printf("}\n");
8898   return;   8898   return;
8899 }   8899 }
8900 }   8900 }
8901 static void ( __attribute__((__noinline__)) laog__add_edge)(Lock *src ,   8901 static void ( __attribute__((__noinline__)) laog__add_edge)(Lock *src ,
8902                                                             Lock *dst )   8902                                                             Lock *dst )
8903 {   8903 {
8904   Word keyW ;   8904   Word keyW ;
8905   LAOGLinks *links ;   8905   LAOGLinks *links ;
8906   Bool presentF ;   8906   Bool presentF ;
8907   Bool presentR ;   8907   Bool presentR ;
8908   WordSetID outs_new ;   8908   WordSetID outs_new ;
8909   void *tmp ;   8909   void *tmp ;
8910   Bool tmp___0 ;   8910   Bool tmp___0 ;
8911   WordSetID inns_new ;   8911   WordSetID inns_new ;
8912   void *tmp___1 ;   8912   void *tmp___1 ;
8913   Bool tmp___2 ;   8913   Bool tmp___2 ;
8914   LAOGLinkExposition expo ;   8914   LAOGLinkExposition expo ;
8915   LAOGLinkExposition *expo2 ;   8915   LAOGLinkExposition *expo2 ;
8916   void *tmp___3 ;   8916   void *tmp___3 ;
8917   Bool tmp___4 ;   8917   Bool tmp___4 ;
8918     8918  
8919   {   8919   {
8920   presentR = (Bool )0;   8920   presentR = (Bool )0;
8921   presentF = presentR;   8921   presentF = presentR;
8922   keyW = (Word )0;   8922   keyW = (Word )0;
8923   links = (LAOGLinks *)((void *)0);   8923   links = (LAOGLinks *)((void *)0);
8924   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   8924   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
8925                              (UWord *)((Word *)(& links)), (UWord )((Word )src));   8925                              (UWord *)((Word *)(& links)), (UWord )((Word )src));
8926   if (tmp___0) {   8926   if (tmp___0) {
8927     if (links) {   8927     if (links) {
8928     8928  
8929     } else {   8929     } else {
8930       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   8930       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
8931                           (Char const   *)"hg_main.c", 3223,   8931                           (Char const   *)"hg_main.c", 3223,
8932                           (Char const   *)"laog__add_edge", "");   8932                           (Char const   *)"laog__add_edge", "");
8933     }   8933     }
8934     if (keyW == (Word )src) {   8934     if (keyW == (Word )src) {
8935     8935  
8936     } else {   8936     } else {
8937       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",   8937       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",
8938                           (Char const   *)"hg_main.c", 3224,   8938                           (Char const   *)"hg_main.c", 3224,
8939                           (Char const   *)"laog__add_edge", "");   8939                           (Char const   *)"laog__add_edge", "");
8940     }   8940     }
8941     outs_new = vgHelgrind_addToWS(univ_laog, links->outs, (UWord )((Word )dst));   8941     outs_new = vgHelgrind_addToWS(univ_laog, links->outs, (UWord )((Word )dst));
8942     presentF = (Bool )(outs_new == links->outs);   8942     presentF = (Bool )(outs_new == links->outs);
8943     links->outs = outs_new;   8943     links->outs = outs_new;
8944   } else {   8944   } else {
8945     tmp = vgHelgrind_zalloc((HChar *)"hg.lae.1", (SizeT )sizeof(LAOGLinks ));   8945     tmp = vgHelgrind_zalloc((HChar *)"hg.lae.1", (SizeT )sizeof(LAOGLinks ));
8946     links = (LAOGLinks *)tmp;   8946     links = (LAOGLinks *)tmp;
8947     links->inns = vgHelgrind_emptyWS(univ_laog);   8947     links->inns = vgHelgrind_emptyWS(univ_laog);
8948     links->outs = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )dst));   8948     links->outs = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )dst));
8949     vgPlain_addToFM(laog, (UWord )((Word )src), (UWord )((Word )links));   8949     vgPlain_addToFM(laog, (UWord )((Word )src), (UWord )((Word )links));
8950   }   8950   }
8951   keyW = (Word )0;   8951   keyW = (Word )0;
8952   links = (LAOGLinks *)((void *)0);   8952   links = (LAOGLinks *)((void *)0);
8953   tmp___2 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   8953   tmp___2 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
8954                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));   8954                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));
8955   if (tmp___2) {   8955   if (tmp___2) {
8956     if (links) {   8956     if (links) {
8957     8957  
8958     } else {   8958     } else {
8959       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   8959       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
8960                           (Char const   *)"hg_main.c", 3239,   8960                           (Char const   *)"hg_main.c", 3239,
8961                           (Char const   *)"laog__add_edge", "");   8961                           (Char const   *)"laog__add_edge", "");
8962     }   8962     }
8963     if (keyW == (Word )dst) {   8963     if (keyW == (Word )dst) {
8964     8964  
8965     } else {   8965     } else {
8966       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",   8966       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",
8967                           (Char const   *)"hg_main.c", 3240,   8967                           (Char const   *)"hg_main.c", 3240,
8968                           (Char const   *)"laog__add_edge", "");   8968                           (Char const   *)"laog__add_edge", "");
8969     }   8969     }
8970     inns_new = vgHelgrind_addToWS(univ_laog, links->inns, (UWord )((Word )src));   8970     inns_new = vgHelgrind_addToWS(univ_laog, links->inns, (UWord )((Word )src));
8971     presentR = (Bool )(inns_new == links->inns);   8971     presentR = (Bool )(inns_new == links->inns);
8972     links->inns = inns_new;   8972     links->inns = inns_new;
8973   } else {   8973   } else {
8974     tmp___1 = vgHelgrind_zalloc((HChar *)"hg.lae.2", (SizeT )sizeof(LAOGLinks ));   8974     tmp___1 = vgHelgrind_zalloc((HChar *)"hg.lae.2", (SizeT )sizeof(LAOGLinks ));
8975     links = (LAOGLinks *)tmp___1;   8975     links = (LAOGLinks *)tmp___1;
8976     links->inns = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )src));   8976     links->inns = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )src));
8977     links->outs = vgHelgrind_emptyWS(univ_laog);   8977     links->outs = vgHelgrind_emptyWS(univ_laog);
8978     vgPlain_addToFM(laog, (UWord )((Word )dst), (UWord )((Word )links));   8978     vgPlain_addToFM(laog, (UWord )((Word )dst), (UWord )((Word )links));
8979   }   8979   }
8980   if (presentF) {   8980   if (presentF) {
8981     if (presentR) {   8981     if (presentR) {
8982     8982  
8983     } else {   8983     } else {
8984       goto _L;   8984       goto _L;
8985     }   8985     }
8986   } else   8986   } else
8987   _L: /* CIL Label */   8987   _L: /* CIL Label */
8988   if (! presentF) {   8988   if (! presentF) {
8989     if (! presentR) {   8989     if (! presentR) {
8990     8990  
8991     } else {   8991     } else {
8992       vgPlain_assert_fail((Bool )0,   8992       vgPlain_assert_fail((Bool )0,
8993                           (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",   8993                           (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",
8994                           (Char const   *)"hg_main.c", 3251,   8994                           (Char const   *)"hg_main.c", 3251,
8995                           (Char const   *)"laog__add_edge", "");   8995                           (Char const   *)"laog__add_edge", "");
8996     }   8996     }
8997   } else {   8997   } else {
8998     vgPlain_assert_fail((Bool )0,   8998     vgPlain_assert_fail((Bool )0,
8999                         (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",   8999                         (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",
9000                         (Char const   *)"hg_main.c", 3251,   9000                         (Char const   *)"hg_main.c", 3251,
9001                         (Char const   *)"laog__add_edge", "");   9001                         (Char const   *)"laog__add_edge", "");
9002   }   9002   }
9003   if (! presentF) {   9003   if (! presentF) {
9004     if (src->acquired_at) {   9004     if (src->acquired_at) {
9005       if (dst->acquired_at) {   9005       if (dst->acquired_at) {
9006         expo.src_ga = src->guestaddr;   9006         expo.src_ga = src->guestaddr;
9007         expo.dst_ga = dst->guestaddr;   9007         expo.dst_ga = dst->guestaddr;
9008         expo.src_ec = (ExeContext *)((void *)0);   9008         expo.src_ec = (ExeContext *)((void *)0);
9009         expo.dst_ec = (ExeContext *)((void *)0);   9009         expo.dst_ec = (ExeContext *)((void *)0);
9010         if (laog_exposition) {   9010         if (laog_exposition) {
9011     9011  
9012         } else {   9012         } else {
9013           vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",   9013           vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",
9014                               (Char const   *)"hg_main.c", 3266,   9014                               (Char const   *)"hg_main.c", 3266,
9015                               (Char const   *)"laog__add_edge", "");   9015                               (Char const   *)"laog__add_edge", "");
9016         }   9016         }
9017         tmp___4 = vgPlain_lookupFM(laog_exposition, (UWord *)((void *)0),   9017         tmp___4 = vgPlain_lookupFM(laog_exposition, (UWord *)((void *)0),
9018                                    (UWord *)((void *)0),   9018                                    (UWord *)((void *)0),
9019                                    (UWord )((Word )(& expo)));   9019                                    (UWord )((Word )(& expo)));
9020         if (tmp___4) {   9020         if (tmp___4) {
9021     9021  
9022         } else {   9022         } else {
9023           tmp___3 = vgHelgrind_zalloc((HChar *)"hg.lae.3",   9023           tmp___3 = vgHelgrind_zalloc((HChar *)"hg.lae.3",
9024                                       (SizeT )sizeof(LAOGLinkExposition ));   9024                                       (SizeT )sizeof(LAOGLinkExposition ));
9025           expo2 = (LAOGLinkExposition *)tmp___3;   9025           expo2 = (LAOGLinkExposition *)tmp___3;
    -+ 9026           {
      9027           memset(expo2, 0, sizeof(LAOGLinkExposition ));
9026           expo2->src_ga = src->guestaddr; = 9028           expo2->src_ga = src->guestaddr;
    -+ 9029           }
9027           expo2->dst_ga = dst->guestaddr; = 9030           expo2->dst_ga = dst->guestaddr;
9028           expo2->src_ec = src->acquired_at;   9031           expo2->src_ec = src->acquired_at;
9029           expo2->dst_ec = dst->acquired_at;   9032           expo2->dst_ec = dst->acquired_at;
9030           vgPlain_addToFM(laog_exposition, (UWord )((Word )expo2),   9033           vgPlain_addToFM(laog_exposition, (UWord )((Word )expo2),
9031                           (UWord )((Word )((void *)0)));   9034                           (UWord )((Word )((void *)0)));
9032         }   9035         }
9033       } else {   9036       } else {
9034     9037  
9035       }   9038       }
9036     } else {   9039     } else {
9037     9040  
9038     }   9041     }
9039   } else {   9042   } else {
9040     9043  
9041   }   9044   }
9042   return;   9045   return;
9043 }   9046 }
9044 }   9047 }
9045 static void ( __attribute__((__noinline__)) laog__del_edge)(Lock *src ,   9048 static void ( __attribute__((__noinline__)) laog__del_edge)(Lock *src ,
9046                                                             Lock *dst )   9049                                                             Lock *dst )
9047 {   9050 {
9048   Word keyW ;   9051   Word keyW ;
9049   LAOGLinks *links ;   9052   LAOGLinks *links ;
9050   Bool tmp ;   9053   Bool tmp ;
9051   Bool tmp___0 ;   9054   Bool tmp___0 ;
9052     9055  
9053   {   9056   {
9054   keyW = (Word )0;   9057   keyW = (Word )0;
9055   links = (LAOGLinks *)((void *)0);   9058   links = (LAOGLinks *)((void *)0);
9056   tmp = vgPlain_lookupFM(laog, (UWord *)(& keyW), (UWord *)((Word *)(& links)),   9059   tmp = vgPlain_lookupFM(laog, (UWord *)(& keyW), (UWord *)((Word *)(& links)),
9057                          (UWord )((Word )src));   9060                          (UWord )((Word )src));
9058   if (tmp) {   9061   if (tmp) {
9059     if (links) {   9062     if (links) {
9060     9063  
9061     } else {   9064     } else {
9062       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9065       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9063                           (Char const   *)"hg_main.c", 3290,   9066                           (Char const   *)"hg_main.c", 3290,
9064                           (Char const   *)"laog__del_edge", "");   9067                           (Char const   *)"laog__del_edge", "");
9065     }   9068     }
9066     if (keyW == (Word )src) {   9069     if (keyW == (Word )src) {
9067     9070  
9068     } else {   9071     } else {
9069       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",   9072       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",
9070                           (Char const   *)"hg_main.c", 3291,   9073                           (Char const   *)"hg_main.c", 3291,
9071                           (Char const   *)"laog__del_edge", "");   9074                           (Char const   *)"laog__del_edge", "");
9072     }   9075     }
9073     links->outs = vgHelgrind_delFromWS(univ_laog, links->outs,   9076     links->outs = vgHelgrind_delFromWS(univ_laog, links->outs,
9074                                        (UWord )((Word )dst));   9077                                        (UWord )((Word )dst));
9075   } else {   9078   } else {
9076     9079  
9077   }   9080   }
9078   keyW = (Word )0;   9081   keyW = (Word )0;
9079   links = (LAOGLinks *)((void *)0);   9082   links = (LAOGLinks *)((void *)0);
9080   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   9083   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
9081                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));   9084                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));
9082   if (tmp___0) {   9085   if (tmp___0) {
9083     if (links) {   9086     if (links) {
9084     9087  
9085     } else {   9088     } else {
9086       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9089       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9087                           (Char const   *)"hg_main.c", 3298,   9090                           (Char const   *)"hg_main.c", 3298,
9088                           (Char const   *)"laog__del_edge", "");   9091                           (Char const   *)"laog__del_edge", "");
9089     }   9092     }
9090     if (keyW == (Word )dst) {   9093     if (keyW == (Word )dst) {
9091     9094  
9092     } else {   9095     } else {
9093       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",   9096       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",
9094                           (Char const   *)"hg_main.c", 3299,   9097                           (Char const   *)"hg_main.c", 3299,
9095                           (Char const   *)"laog__del_edge", "");   9098                           (Char const   *)"laog__del_edge", "");
9096     }   9099     }
9097     links->inns = vgHelgrind_delFromWS(univ_laog, links->inns,   9100     links->inns = vgHelgrind_delFromWS(univ_laog, links->inns,
9098                                        (UWord )((Word )src));   9101                                        (UWord )((Word )src));
9099   } else {   9102   } else {
9100     9103  
9101   }   9104   }
9102   return;   9105   return;
9103 }   9106 }
9104 }   9107 }
9105 static WordSetID ( __attribute__((__noinline__)) laog__succs)(Lock *lk )   9108 static WordSetID ( __attribute__((__noinline__)) laog__succs)(Lock *lk )
9106 {   9109 {
9107   Word keyW ;   9110   Word keyW ;
9108   LAOGLinks *links ;   9111   LAOGLinks *links ;
9109   WordSet tmp ;   9112   WordSet tmp ;
9110   Bool tmp___0 ;   9113   Bool tmp___0 ;
9111     9114  
9112   {   9115   {
9113   keyW = (Word )0;   9116   keyW = (Word )0;
9114   links = (LAOGLinks *)((void *)0);   9117   links = (LAOGLinks *)((void *)0);
9115   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   9118   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
9116                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));   9119                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));
9117   if (tmp___0) {   9120   if (tmp___0) {
9118     if (links) {   9121     if (links) {
9119     9122  
9120     } else {   9123     } else {
9121       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9124       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9122                           (Char const   *)"hg_main.c", 3311,   9125                           (Char const   *)"hg_main.c", 3311,
9123                           (Char const   *)"laog__succs", "");   9126                           (Char const   *)"laog__succs", "");
9124     }   9127     }
9125     if (keyW == (Word )lk) {   9128     if (keyW == (Word )lk) {
9126     9129  
9127     } else {   9130     } else {
9128       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",   9131       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",
9129                           (Char const   *)"hg_main.c", 3312,   9132                           (Char const   *)"hg_main.c", 3312,
9130                           (Char const   *)"laog__succs", "");   9133                           (Char const   *)"laog__succs", "");
9131     }   9134     }
9132     return (links->outs);   9135     return (links->outs);
9133   } else {   9136   } else {
9134     tmp = vgHelgrind_emptyWS(univ_laog);   9137     tmp = vgHelgrind_emptyWS(univ_laog);
9135     return (tmp);   9138     return (tmp);
9136   }   9139   }
9137 }   9140 }
9138 }   9141 }
9139 static WordSetID ( __attribute__((__noinline__)) laog__preds)(Lock *lk )   9142 static WordSetID ( __attribute__((__noinline__)) laog__preds)(Lock *lk )
9140 {   9143 {
9141   Word keyW ;   9144   Word keyW ;
9142   LAOGLinks *links ;   9145   LAOGLinks *links ;
9143   WordSet tmp ;   9146   WordSet tmp ;
9144   Bool tmp___0 ;   9147   Bool tmp___0 ;
9145     9148  
9146   {   9149   {
9147   keyW = (Word )0;   9150   keyW = (Word )0;
9148   links = (LAOGLinks *)((void *)0);   9151   links = (LAOGLinks *)((void *)0);
9149   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   9152   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
9150                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));   9153                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));
9151   if (tmp___0) {   9154   if (tmp___0) {
9152     if (links) {   9155     if (links) {
9153     9156  
9154     } else {   9157     } else {
9155       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9158       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9156                           (Char const   *)"hg_main.c", 3326,   9159                           (Char const   *)"hg_main.c", 3326,
9157                           (Char const   *)"laog__preds", "");   9160                           (Char const   *)"laog__preds", "");
9158     }   9161     }
9159     if (keyW == (Word )lk) {   9162     if (keyW == (Word )lk) {
9160     9163  
9161     } else {   9164     } else {
9162       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",   9165       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",
9163                           (Char const   *)"hg_main.c", 3327,   9166                           (Char const   *)"hg_main.c", 3327,
9164                           (Char const   *)"laog__preds", "");   9167                           (Char const   *)"laog__preds", "");
9165     }   9168     }
9166     return (links->inns);   9169     return (links->inns);
9167   } else {   9170   } else {
9168     tmp = vgHelgrind_emptyWS(univ_laog);   9171     tmp = vgHelgrind_emptyWS(univ_laog);
9169     return (tmp);   9172     return (tmp);
9170   }   9173   }
9171 }   9174 }
9172 }   9175 }
9173 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who )   9176 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who )
9174 {   9177 {
9175   Word i ;   9178   Word i ;
9176   Word ws_size ;   9179   Word ws_size ;
9177   UWord *ws_words ;   9180   UWord *ws_words ;
9178   Lock *me ;   9181   Lock *me ;
9179   LAOGLinks *links ;   9182   LAOGLinks *links ;
9180   WordSetID tmp ;   9183   WordSetID tmp ;
9181   Bool tmp___0 ;   9184   Bool tmp___0 ;
9182   WordSetID tmp___1 ;   9185   WordSetID tmp___1 ;
9183   Bool tmp___2 ;   9186   Bool tmp___2 ;
9184   Bool tmp___3 ;   9187   Bool tmp___3 ;
9185     9188  
9186   {   9189   {
9187   vgPlain_initIterFM(laog);   9190   vgPlain_initIterFM(laog);
9188   me = (Lock *)((void *)0);   9191   me = (Lock *)((void *)0);
9189   links = (LAOGLinks *)((void *)0);   9192   links = (LAOGLinks *)((void *)0);
9190   while (1) {   9193   while (1) {
9191     tmp___3 = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),   9194     tmp___3 = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),
9192                                  (UWord *)((Word *)(& links)));   9195                                  (UWord *)((Word *)(& links)));
9193     if (tmp___3) {   9196     if (tmp___3) {
9194     9197  
9195     } else {   9198     } else {
9196       break;   9199       break;
9197     }   9200     }
9198     if (me) {   9201     if (me) {
9199     9202  
9200     } else {   9203     } else {
9201       vgPlain_assert_fail((Bool )0, (Char const   *)"me",   9204       vgPlain_assert_fail((Bool )0, (Char const   *)"me",
9202                           (Char const   *)"hg_main.c", 3346,   9205                           (Char const   *)"hg_main.c", 3346,
9203                           (Char const   *)"laog__sanity_check", "");   9206                           (Char const   *)"laog__sanity_check", "");
9204     }   9207     }
9205     if (links) {   9208     if (links) {
9206     9209  
9207     } else {   9210     } else {
9208       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9211       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9209                           (Char const   *)"hg_main.c", 3347,   9212                           (Char const   *)"hg_main.c", 3347,
9210                           (Char const   *)"laog__sanity_check", "");   9213                           (Char const   *)"laog__sanity_check", "");
9211     }   9214     }
9212     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   9215     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
9213                             links->inns);   9216                             links->inns);
9214     i = (Word )0;   9217     i = (Word )0;
9215     while (i < ws_size) {   9218     while (i < ws_size) {
9216       tmp = laog__succs((Lock *)*(ws_words + i));   9219       tmp = laog__succs((Lock *)*(ws_words + i));
9217       tmp___0 = vgHelgrind_elemWS(univ_laog, tmp, (UWord )((Word )me));   9220       tmp___0 = vgHelgrind_elemWS(univ_laog, tmp, (UWord )((Word )me));
9218       if (tmp___0) {   9221       if (tmp___0) {
9219     9222  
9220       } else {   9223       } else {
9221         goto bad;   9224         goto bad;
9222       }   9225       }
9223       i ++;   9226       i ++;
9224     }   9227     }
9225     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   9228     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
9226                             links->outs);   9229                             links->outs);
9227     i = (Word )0;   9230     i = (Word )0;
9228     while (i < ws_size) {   9231     while (i < ws_size) {
9229       tmp___1 = laog__preds((Lock *)*(ws_words + i));   9232       tmp___1 = laog__preds((Lock *)*(ws_words + i));
9230       tmp___2 = vgHelgrind_elemWS(univ_laog, tmp___1, (UWord )((Word )me));   9233       tmp___2 = vgHelgrind_elemWS(univ_laog, tmp___1, (UWord )((Word )me));
9231       if (tmp___2) {   9234       if (tmp___2) {
9232     9235  
9233       } else {   9236       } else {
9234         goto bad;   9237         goto bad;
9235       }   9238       }
9236       i ++;   9239       i ++;
9237     }   9240     }
9238     me = (Lock *)((void *)0);   9241     me = (Lock *)((void *)0);
9239     links = (LAOGLinks *)((void *)0);   9242     links = (LAOGLinks *)((void *)0);
9240   }   9243   }
9241   vgPlain_doneIterFM(laog);   9244   vgPlain_doneIterFM(laog);
9242   return;   9245   return;
9243   bad:   9246   bad:
9244   vgPlain_printf("laog__sanity_check(%s) FAILED\n", who);   9247   vgPlain_printf("laog__sanity_check(%s) FAILED\n", who);
9245   laog__show(who);   9248   laog__show(who);
9246   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   9249   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
9247                       (Char const   *)"hg_main.c", 3371,   9250                       (Char const   *)"hg_main.c", 3371,
9248                       (Char const   *)"laog__sanity_check", "");   9251                       (Char const   *)"laog__sanity_check", "");
9249 }   9252 }
9250 }   9253 }
9251 static Lock *( __attribute__((__noinline__)) laog__do_dfs_from_to)(Lock *src ,   9254 static Lock *( __attribute__((__noinline__)) laog__do_dfs_from_to)(Lock *src ,
9252                                                                    WordSetID dsts )   9255                                                                    WordSetID dsts )
9253 {   9256 {
9254   Lock *ret ;   9257   Lock *ret ;
9255   Word i ;   9258   Word i ;
9256   Word ssz ;   9259   Word ssz ;
9257   XArray *stack ;   9260   XArray *stack ;
9258   WordFM *visited ;   9261   WordFM *visited ;
9259   Lock *here ;   9262   Lock *here ;
9260   WordSetID succs ;   9263   WordSetID succs ;
9261   Word succs_size ;   9264   Word succs_size ;
9262   UWord *succs_words ;   9265   UWord *succs_words ;
9263   Bool tmp ;   9266   Bool tmp ;
9264   void *tmp___0 ;   9267   void *tmp___0 ;
9265   Bool tmp___1 ;   9268   Bool tmp___1 ;
9266   Bool tmp___2 ;   9269   Bool tmp___2 ;
9267     9270  
9268   {   9271   {
9269   tmp = vgHelgrind_isEmptyWS(univ_lsets, dsts);   9272   tmp = vgHelgrind_isEmptyWS(univ_lsets, dsts);
9270   if (tmp) {   9273   if (tmp) {
9271     return ((Lock *)((void *)0));   9274     return ((Lock *)((void *)0));
9272   } else {   9275   } else {
9273     9276  
9274   }   9277   }
9275   ret = (Lock *)((void *)0);   9278   ret = (Lock *)((void *)0);
9276   stack = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.lddft.1",   9279   stack = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.lddft.1",
9277                         & vgHelgrind_free, (Word )sizeof(Lock *));   9280                         & vgHelgrind_free, (Word )sizeof(Lock *));
9278   visited = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.lddft.2",   9281   visited = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.lddft.2",
9279                           & vgHelgrind_free,   9282                           & vgHelgrind_free,
9280                           (Word (*)(UWord  , UWord  ))((void *)0));   9283                           (Word (*)(UWord  , UWord  ))((void *)0));
9281   vgPlain_addToXA(stack, (void *)(& src));   9284   vgPlain_addToXA(stack, (void *)(& src));
9282   while (1) {   9285   while (1) {
9283     ssz = vgPlain_sizeXA(stack);   9286     ssz = vgPlain_sizeXA(stack);
9284     if (ssz == 0L) {   9287     if (ssz == 0L) {
9285       ret = (Lock *)((void *)0);   9288       ret = (Lock *)((void *)0);
9286       break;   9289       break;
9287     } else {   9290     } else {
9288     9291  
9289     }   9292     }
9290     tmp___0 = vgPlain_indexXA(stack, ssz - 1L);   9293     tmp___0 = vgPlain_indexXA(stack, ssz - 1L);
9291     here = *((Lock **)tmp___0);   9294     here = *((Lock **)tmp___0);
9292     vgPlain_dropTailXA(stack, (Word )1);   9295     vgPlain_dropTailXA(stack, (Word )1);
9293     tmp___1 = vgHelgrind_elemWS(univ_lsets, dsts, (UWord )((Word )here));   9296     tmp___1 = vgHelgrind_elemWS(univ_lsets, dsts, (UWord )((Word )here));
9294     if (tmp___1) {   9297     if (tmp___1) {
9295       ret = here;   9298       ret = here;
9296       break;   9299       break;
9297     } else {   9300     } else {
9298     9301  
9299     }   9302     }
9300     tmp___2 = vgPlain_lookupFM(visited, (UWord *)((void *)0),   9303     tmp___2 = vgPlain_lookupFM(visited, (UWord *)((void *)0),
9301                                (UWord *)((void *)0), (UWord )((Word )here));   9304                                (UWord *)((void *)0), (UWord )((Word )here));
9302     if (tmp___2) {   9305     if (tmp___2) {
9303       continue;   9306       continue;
9304     } else {   9307     } else {
9305     9308  
9306     }   9309     }
9307     vgPlain_addToFM(visited, (UWord )((Word )here), (UWord )0);   9310     vgPlain_addToFM(visited, (UWord )((Word )here), (UWord )0);
9308     succs = laog__succs(here);   9311     succs = laog__succs(here);
9309     vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,   9312     vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,
9310                             succs);   9313                             succs);
9311     i = (Word )0;   9314     i = (Word )0;
9312     while (i < succs_size) {   9315     while (i < succs_size) {
9313       vgPlain_addToXA(stack, (void *)(succs_words + i));   9316       vgPlain_addToXA(stack, (void *)(succs_words + i));
9314       i ++;   9317       i ++;
9315     }   9318     }
9316   }   9319   }
9317   vgPlain_deleteFM(visited, (void (*)(UWord  ))((void *)0),   9320   vgPlain_deleteFM(visited, (void (*)(UWord  ))((void *)0),
9318                    (void (*)(UWord  ))((void *)0));   9321                    (void (*)(UWord  ))((void *)0));
9319   vgPlain_deleteXA(stack);   9322   vgPlain_deleteXA(stack);
9320   return (ret);   9323   return (ret);
9321 }   9324 }
9322 }   9325 }
9323 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,   9326 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,
9324                                                                             Lock *lk )   9327                                                                             Lock *lk )
9325 {   9328 {
9326   UWord *ls_words ;   9329   UWord *ls_words ;
9327   Word ls_size ;   9330   Word ls_size ;
9328   Word i ;   9331   Word i ;
9329   Lock *other ;   9332   Lock *other ;
9330   Bool tmp ;   9333   Bool tmp ;
9331   LAOGLinkExposition key ;   9334   LAOGLinkExposition key ;
9332   LAOGLinkExposition *found ;   9335   LAOGLinkExposition *found ;
9333   Bool tmp___0 ;   9336   Bool tmp___0 ;
9334   Lock *old ;   9337   Lock *old ;
9335     9338  
9336   {   9339   {
9337   tmp = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));   9340   tmp = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));
9338   if (tmp) {   9341   if (tmp) {
9339     return;   9342     return;
9340   } else {   9343   } else {
9341     9344  
9342   }   9345   }
9343   other = laog__do_dfs_from_to(lk, thr->locksetA);   9346   other = laog__do_dfs_from_to(lk, thr->locksetA);
9344   if (other) {   9347   if (other) {
9345     key.src_ga = lk->guestaddr;   9348     key.src_ga = lk->guestaddr;
9346     key.dst_ga = other->guestaddr;   9349     key.dst_ga = other->guestaddr;
9347     key.src_ec = (ExeContext *)((void *)0);   9350     key.src_ec = (ExeContext *)((void *)0);
9348     key.dst_ec = (ExeContext *)((void *)0);   9351     key.dst_ec = (ExeContext *)((void *)0);
9349     found = (LAOGLinkExposition *)((void *)0);   9352     found = (LAOGLinkExposition *)((void *)0);
9350     tmp___0 = vgPlain_lookupFM(laog_exposition, (UWord *)((Word *)(& found)),   9353     tmp___0 = vgPlain_lookupFM(laog_exposition, (UWord *)((Word *)(& found)),
9351                                (UWord *)((void *)0), (UWord )((Word )(& key)));   9354                                (UWord *)((void *)0), (UWord )((Word )(& key)));
9352     if (tmp___0) {   9355     if (tmp___0) {
9353       if ((unsigned int )found != (unsigned int )(& key)) {   9356       if ((unsigned int )found != (unsigned int )(& key)) {
9354     9357  
9355       } else {   9358       } else {
9356         vgPlain_assert_fail((Bool )0, (Char const   *)"found != &key",   9359         vgPlain_assert_fail((Bool )0, (Char const   *)"found != &key",
9357                             (Char const   *)"hg_main.c", 3474,   9360                             (Char const   *)"hg_main.c", 3474,
9358                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9361                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9359       }   9362       }
9360       if (found->src_ga == key.src_ga) {   9363       if (found->src_ga == key.src_ga) {
9361     9364  
9362       } else {   9365       } else {
9363         vgPlain_assert_fail((Bool )0,   9366         vgPlain_assert_fail((Bool )0,
9364                             (Char const   *)"found->src_ga == key.src_ga",   9367                             (Char const   *)"found->src_ga == key.src_ga",
9365                             (Char const   *)"hg_main.c", 3475,   9368                             (Char const   *)"hg_main.c", 3475,
9366                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9369                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9367       }   9370       }
9368       if (found->dst_ga == key.dst_ga) {   9371       if (found->dst_ga == key.dst_ga) {
9369     9372  
9370       } else {   9373       } else {
9371         vgPlain_assert_fail((Bool )0,   9374         vgPlain_assert_fail((Bool )0,
9372                             (Char const   *)"found->dst_ga == key.dst_ga",   9375                             (Char const   *)"found->dst_ga == key.dst_ga",
9373                             (Char const   *)"hg_main.c", 3476,   9376                             (Char const   *)"hg_main.c", 3476,
9374                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9377                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9375       }   9378       }
9376       if (found->src_ec) {   9379       if (found->src_ec) {
9377     9380  
9378       } else {   9381       } else {
9379         vgPlain_assert_fail((Bool )0, (Char const   *)"found->src_ec",   9382         vgPlain_assert_fail((Bool )0, (Char const   *)"found->src_ec",
9380                             (Char const   *)"hg_main.c", 3477,   9383                             (Char const   *)"hg_main.c", 3477,
9381                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9384                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9382       }   9385       }
9383       if (found->dst_ec) {   9386       if (found->dst_ec) {
9384     9387  
9385       } else {   9388       } else {
9386         vgPlain_assert_fail((Bool )0, (Char const   *)"found->dst_ec",   9389         vgPlain_assert_fail((Bool )0, (Char const   *)"found->dst_ec",
9387                             (Char const   *)"hg_main.c", 3478,   9390                             (Char const   *)"hg_main.c", 3478,
9388                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9391                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9389       }   9392       }
9390       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,   9393       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,
9391                                         found->src_ec, found->dst_ec);   9394                                         found->src_ec, found->dst_ec);
9392     } else {   9395     } else {
9393       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,   9396       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,
9394                                         (ExeContext *)((void *)0),   9397                                         (ExeContext *)((void *)0),
9395                                         (ExeContext *)((void *)0));   9398                                         (ExeContext *)((void *)0));
9396     }   9399     }
9397   } else {   9400   } else {
9398     9401  
9399   }   9402   }
9400   if (lk->acquired_at) {   9403   if (lk->acquired_at) {
9401     9404  
9402   } else {   9405   } else {
9403     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",   9406     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",
9404                         (Char const   *)"hg_main.c", 3495,   9407                         (Char const   *)"hg_main.c", 3495,
9405                         (Char const   *)"laog__pre_thread_acquires_lock", "");   9408                         (Char const   *)"laog__pre_thread_acquires_lock", "");
9406   }   9409   }
9407   vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets,   9410   vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets,
9408                           thr->locksetA);   9411                           thr->locksetA);
9409   i = (Word )0;   9412   i = (Word )0;
9410   while (i < ls_size) {   9413   while (i < ls_size) {
9411     old = (Lock *)*(ls_words + i);   9414     old = (Lock *)*(ls_words + i);
9412     if (old->acquired_at) {   9415     if (old->acquired_at) {
9413     9416  
9414     } else {   9417     } else {
9415       vgPlain_assert_fail((Bool )0, (Char const   *)"old->acquired_at",   9418       vgPlain_assert_fail((Bool )0, (Char const   *)"old->acquired_at",
9416                           (Char const   *)"hg_main.c", 3499,   9419                           (Char const   *)"hg_main.c", 3499,
9417                           (Char const   *)"laog__pre_thread_acquires_lock", "");   9420                           (Char const   *)"laog__pre_thread_acquires_lock", "");
9418     }   9421     }
9419     laog__add_edge(old, lk);   9422     laog__add_edge(old, lk);
9420     i ++;   9423     i ++;
9421   }   9424   }
9422   if (vgHelgrind_clo_sanity_flags & (long )(1 << 4)) {   9425   if (vgHelgrind_clo_sanity_flags & (long )(1 << 4)) {
9423     all_except_Locks__sanity_check((Char *)"laog__pre_thread_acquires_lock-post");   9426     all_except_Locks__sanity_check((Char *)"laog__pre_thread_acquires_lock-post");
9424   } else {   9427   } else {
9425     9428  
9426   }   9429   }
9427   return;   9430   return;
9428 }   9431 }
9429 }   9432 }
9430 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk )   9433 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk )
9431 {   9434 {
9432   WordSetID preds ;   9435   WordSetID preds ;
9433   WordSetID succs ;   9436   WordSetID succs ;
9434   Word preds_size ;   9437   Word preds_size ;
9435   Word succs_size ;   9438   Word succs_size ;
9436   Word i ;   9439   Word i ;
9437   Word j ;   9440   Word j ;
9438   UWord *preds_words ;   9441   UWord *preds_words ;
9439   UWord *succs_words ;   9442   UWord *succs_words ;
9440     9443  
9441   {   9444   {
9442   preds = laog__preds(lk);   9445   preds = laog__preds(lk);
9443   succs = laog__succs(lk);   9446   succs = laog__succs(lk);
9444   vgHelgrind_getPayloadWS(& preds_words, (UWord *)(& preds_size), univ_laog,   9447   vgHelgrind_getPayloadWS(& preds_words, (UWord *)(& preds_size), univ_laog,
9445                           preds);   9448                           preds);
9446   i = (Word )0;   9449   i = (Word )0;
9447   while (i < preds_size) {   9450   while (i < preds_size) {
9448     laog__del_edge((Lock *)*(preds_words + i), lk);   9451     laog__del_edge((Lock *)*(preds_words + i), lk);
9449     i ++;   9452     i ++;
9450   }   9453   }
9451   vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,   9454   vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,
9452                           succs);   9455                           succs);
9453   j = (Word )0;   9456   j = (Word )0;
9454   while (j < succs_size) {   9457   while (j < succs_size) {
9455     laog__del_edge(lk, (Lock *)*(succs_words + j));   9458     laog__del_edge(lk, (Lock *)*(succs_words + j));
9456     j ++;   9459     j ++;
9457   }   9460   }
9458   i = (Word )0;   9461   i = (Word )0;
9459   while (i < preds_size) {   9462   while (i < preds_size) {
9460     j = (Word )0;   9463     j = (Word )0;
9461     while (j < succs_size) {   9464     while (j < succs_size) {
9462       if (*(preds_words + i) != *(succs_words + j)) {   9465       if (*(preds_words + i) != *(succs_words + j)) {
9463         laog__add_edge((Lock *)*(preds_words + i), (Lock *)*(succs_words + j));   9466         laog__add_edge((Lock *)*(preds_words + i), (Lock *)*(succs_words + j));
9464       } else {   9467       } else {
9465     9468  
9466       }   9469       }
9467       j ++;   9470       j ++;
9468     }   9471     }
9469     i ++;   9472     i ++;
9470   }   9473   }
9471   return;   9474   return;
9472 }   9475 }
9473 }   9476 }
9474 static VgHashTable hg_mallocmeta_table  =    (VgHashTable )((void *)0);   9477 static VgHashTable hg_mallocmeta_table  =    (VgHashTable )((void *)0);
9475 static MallocMeta *new_MallocMeta(void)   9478 static MallocMeta *new_MallocMeta(void)
9476 {   9479 {
9477   MallocMeta *md ;   9480   MallocMeta *md ;
9478   void *tmp ;   9481   void *tmp ;
9479     9482  
9480   {   9483   {
9481   tmp = vgHelgrind_zalloc((HChar *)"hg.new_MallocMeta.1",   9484   tmp = vgHelgrind_zalloc((HChar *)"hg.new_MallocMeta.1",
9482                           (SizeT )sizeof(MallocMeta ));   9485                           (SizeT )sizeof(MallocMeta ));
9483   md = (MallocMeta *)tmp;   9486   md = (MallocMeta *)tmp;
9484   if (md) {   9487   if (md) {
9485     9488  
9486   } else {   9489   } else {
9487     vgPlain_assert_fail((Bool )0, (Char const   *)"md",   9490     vgPlain_assert_fail((Bool )0, (Char const   *)"md",
9488                         (Char const   *)"hg_main.c", 3584,   9491                         (Char const   *)"hg_main.c", 3584,
9489                         (Char const   *)"new_MallocMeta", "");   9492                         (Char const   *)"new_MallocMeta", "");
9490   }   9493   }
9491   return (md);   9494   return (md);
9492 }   9495 }
9493 }   9496 }
9494 static void delete_MallocMeta(MallocMeta *md )   9497 static void delete_MallocMeta(MallocMeta *md )
9495 {   9498 {
9496     9499  
9497     9500  
9498   {   9501   {
9499   vgHelgrind_free((void *)md);   9502   vgHelgrind_free((void *)md);
9500   return;   9503   return;
9501 }   9504 }
9502 }   9505 }
9503 static void *handle_alloc(ThreadId tid , SizeT szB , SizeT alignB ,   9506 static void *handle_alloc(ThreadId tid , SizeT szB , SizeT alignB ,
9504                           Bool is_zeroed )   9507                           Bool is_zeroed )
9505 {   9508 {
9506   Addr p ;   9509   Addr p ;
9507   MallocMeta *md ;   9510   MallocMeta *md ;
9508   void *tmp ;   9511   void *tmp ;
9509     9512  
9510   {   9513   {
9511   if ((SSizeT )szB >= 0L) {   9514   if ((SSizeT )szB >= 0L) {
9512     9515  
9513   } else {   9516   } else {
9514     vgPlain_assert_fail((Bool )0, (Char const   *)"((SSizeT)szB) >= 0",   9517     vgPlain_assert_fail((Bool )0, (Char const   *)"((SSizeT)szB) >= 0",
9515                         (Char const   *)"hg_main.c", 3601,   9518                         (Char const   *)"hg_main.c", 3601,
9516                         (Char const   *)"handle_alloc", "");   9519                         (Char const   *)"handle_alloc", "");
9517   }   9520   }
9518   tmp = vgPlain_cli_malloc(alignB, szB);   9521   tmp = vgPlain_cli_malloc(alignB, szB);
9519   p = (Addr )tmp;   9522   p = (Addr )tmp;
9520   if (! p) {   9523   if (! p) {
9521     return ((void *)0);   9524     return ((void *)0);
9522   } else {   9525   } else {
9523     9526  
9524   }   9527   }
9525   if (is_zeroed) {   9528   if (is_zeroed) {
9526     vgPlain_memset((void *)p, 0, szB);   9529     vgPlain_memset((void *)p, 0, szB);
9527   } else {   9530   } else {
9528     9531  
9529   }   9532   }
9530   md = new_MallocMeta();   9533   md = new_MallocMeta();
9531   md->payload = p;   9534   md->payload = p;
9532   md->szB = szB;   9535   md->szB = szB;
9533   md->where = vgPlain_record_ExeContext(tid, (Word )0);   9536   md->where = vgPlain_record_ExeContext(tid, (Word )0);
9534   md->thr = map_threads_lookup(tid);   9537   md->thr = map_threads_lookup(tid);
9535   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md));   9538   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md));
9536   evh__new_mem_heap(p, szB, is_zeroed);   9539   evh__new_mem_heap(p, szB, is_zeroed);
9537   return ((void *)p);   9540   return ((void *)p);
9538 }   9541 }
9539 }   9542 }
9540 static void *hg_cli__malloc(ThreadId tid , SizeT n )   9543 static void *hg_cli__malloc(ThreadId tid , SizeT n )
9541 {   9544 {
9542   void *tmp ;   9545   void *tmp ;
9543     9546  
9544   {   9547   {
9545   if ((SSizeT )n < 0L) {   9548   if ((SSizeT )n < 0L) {
9546     return ((void *)0);   9549     return ((void *)0);
9547   } else {   9550   } else {
9548     9551  
9549   }   9552   }
9550   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);   9553   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);
9551   return (tmp);   9554   return (tmp);
9552 }   9555 }
9553 }   9556 }
9554 static void *hg_cli____builtin_new(ThreadId tid , SizeT n )   9557 static void *hg_cli____builtin_new(ThreadId tid , SizeT n )
9555 {   9558 {
9556   void *tmp ;   9559   void *tmp ;
9557     9560  
9558   {   9561   {
9559   if ((SSizeT )n < 0L) {   9562   if ((SSizeT )n < 0L) {
9560     return ((void *)0);   9563     return ((void *)0);
9561   } else {   9564   } else {
9562     9565  
9563   }   9566   }
9564   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);   9567   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);
9565   return (tmp);   9568   return (tmp);
9566 }   9569 }
9567 }   9570 }
9568 static void *hg_cli____builtin_vec_new(ThreadId tid , SizeT n )   9571 static void *hg_cli____builtin_vec_new(ThreadId tid , SizeT n )
9569 {   9572 {
9570   void *tmp ;   9573   void *tmp ;
9571     9574  
9572   {   9575   {
9573   if ((SSizeT )n < 0L) {   9576   if ((SSizeT )n < 0L) {
9574     return ((void *)0);   9577     return ((void *)0);
9575   } else {   9578   } else {
9576     9579  
9577   }   9580   }
9578   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);   9581   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);
9579   return (tmp);   9582   return (tmp);
9580 }   9583 }
9581 }   9584 }
9582 static void *hg_cli__memalign(ThreadId tid , SizeT align , SizeT n )   9585 static void *hg_cli__memalign(ThreadId tid , SizeT align , SizeT n )
9583 {   9586 {
9584   void *tmp ;   9587   void *tmp ;
9585     9588  
9586   {   9589   {
9587   if ((SSizeT )n < 0L) {   9590   if ((SSizeT )n < 0L) {
9588     return ((void *)0);   9591     return ((void *)0);
9589   } else {   9592   } else {
9590     9593  
9591   }   9594   }
9592   tmp = handle_alloc(tid, n, align, (Bool )0);   9595   tmp = handle_alloc(tid, n, align, (Bool )0);
9593   return (tmp);   9596   return (tmp);
9594 }   9597 }
9595 }   9598 }
9596 static void *hg_cli__calloc(ThreadId tid , SizeT nmemb , SizeT size1 )   9599 static void *hg_cli__calloc(ThreadId tid , SizeT nmemb , SizeT size1 )
9597 {   9600 {
9598   void *tmp ;   9601   void *tmp ;
9599     9602  
9600   {   9603   {
9601   if ((SSizeT )nmemb < 0L) {   9604   if ((SSizeT )nmemb < 0L) {
9602     return ((void *)0);   9605     return ((void *)0);
9603   } else   9606   } else
9604   if ((SSizeT )size1 < 0L) {   9607   if ((SSizeT )size1 < 0L) {
9605     return ((void *)0);   9608     return ((void *)0);
9606   } else {   9609   } else {
9607     9610  
9608   }   9611   }
9609   tmp = handle_alloc(tid, nmemb * size1, (SizeT )vgPlain_clo_alignment, (Bool )1);   9612   tmp = handle_alloc(tid, nmemb * size1, (SizeT )vgPlain_clo_alignment, (Bool )1);
9610   return (tmp);   9613   return (tmp);
9611 }   9614 }
9612 }   9615 }
9613 static void handle_free(ThreadId tid , void *p )   9616 static void handle_free(ThreadId tid , void *p )
9614 {   9617 {
9615   MallocMeta *md ;   9618   MallocMeta *md ;
9616   MallocMeta *old_md ;   9619   MallocMeta *old_md ;
9617   SizeT szB ;   9620   SizeT szB ;
9618   void *tmp ;   9621   void *tmp ;
9619   void *tmp___0 ;   9622   void *tmp___0 ;
9620     9623  
9621   {   9624   {
9622   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);   9625   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);
9623   md = (MallocMeta *)tmp;   9626   md = (MallocMeta *)tmp;
9624   if (! md) {   9627   if (! md) {
9625     return;   9628     return;
9626   } else {   9629   } else {
9627     9630  
9628   }   9631   }
9629   if (md->payload == (Addr )p) {   9632   if (md->payload == (Addr )p) {
9630     9633  
9631   } else {   9634   } else {
9632     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == (Addr)p",   9635     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == (Addr)p",
9633                         (Char const   *)"hg_main.c", 3671,   9636                         (Char const   *)"hg_main.c", 3671,
9634                         (Char const   *)"handle_free", "");   9637                         (Char const   *)"handle_free", "");
9635   }   9638   }
9636   szB = md->szB;   9639   szB = md->szB;
9637   tmp___0 = vgPlain_HT_remove(hg_mallocmeta_table, (UWord )p);   9640   tmp___0 = vgPlain_HT_remove(hg_mallocmeta_table, (UWord )p);
9638   old_md = (MallocMeta *)tmp___0;   9641   old_md = (MallocMeta *)tmp___0;
9639   if (old_md) {   9642   if (old_md) {
9640     9643  
9641   } else {   9644   } else {
9642     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md",   9645     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md",
9643                         (Char const   *)"hg_main.c", 3677,   9646                         (Char const   *)"hg_main.c", 3677,
9644                         (Char const   *)"handle_free", "");   9647                         (Char const   *)"handle_free", "");
9645   }   9648   }
9646   if ((unsigned int )old_md == (unsigned int )md) {   9649   if ((unsigned int )old_md == (unsigned int )md) {
9647     9650  
9648   } else {   9651   } else {
9649     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md == md",   9652     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md == md",
9650                         (Char const   *)"hg_main.c", 3678,   9653                         (Char const   *)"hg_main.c", 3678,
9651                         (Char const   *)"handle_free", "");   9654                         (Char const   *)"handle_free", "");
9652   }   9655   }
9653   if (old_md->payload == (Addr )p) {   9656   if (old_md->payload == (Addr )p) {
9654     9657  
9655   } else {   9658   } else {
9656     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md->payload == (Addr)p",   9659     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md->payload == (Addr)p",
9657                         (Char const   *)"hg_main.c", 3679,   9660                         (Char const   *)"hg_main.c", 3679,
9658                         (Char const   *)"handle_free", "");   9661                         (Char const   *)"handle_free", "");
9659   }   9662   }
9660   vgPlain_cli_free((void *)old_md->payload);   9663   vgPlain_cli_free((void *)old_md->payload);
9661   delete_MallocMeta(old_md);   9664   delete_MallocMeta(old_md);
9662   evh__die_mem_heap((Addr )p, szB);   9665   evh__die_mem_heap((Addr )p, szB);
9663   return;   9666   return;
9664 }   9667 }
9665 }   9668 }
9666 static void hg_cli__free(ThreadId tid , void *p )   9669 static void hg_cli__free(ThreadId tid , void *p )
9667 {   9670 {
9668     9671  
9669     9672  
9670   {   9673   {
9671   handle_free(tid, p);   9674   handle_free(tid, p);
9672   return;   9675   return;
9673 }   9676 }
9674 }   9677 }
9675 static void hg_cli____builtin_delete(ThreadId tid , void *p )   9678 static void hg_cli____builtin_delete(ThreadId tid , void *p )
9676 {   9679 {
9677     9680  
9678     9681  
9679   {   9682   {
9680   handle_free(tid, p);   9683   handle_free(tid, p);
9681   return;   9684   return;
9682 }   9685 }
9683 }   9686 }
9684 static void hg_cli____builtin_vec_delete(ThreadId tid , void *p )   9687 static void hg_cli____builtin_vec_delete(ThreadId tid , void *p )
9685 {   9688 {
9686     9689  
9687     9690  
9688   {   9691   {
9689   handle_free(tid, p);   9692   handle_free(tid, p);
9690   return;   9693   return;
9691 }   9694 }
9692 }   9695 }
9693 static void *hg_cli__realloc(ThreadId tid , void *payloadV , SizeT new_size )   9696 static void *hg_cli__realloc(ThreadId tid , void *payloadV , SizeT new_size )
9694 {   9697 {
9695   MallocMeta *md ;   9698   MallocMeta *md ;
9696   MallocMeta *md_new ;   9699   MallocMeta *md_new ;
9697   MallocMeta *md_tmp ;   9700   MallocMeta *md_tmp ;
9698   SizeT i ;   9701   SizeT i ;
9699   Addr payload ;   9702   Addr payload ;
9700   void *tmp ;   9703   void *tmp ;
9701   Addr p_new ;   9704   Addr p_new ;
9702   void *tmp___0 ;   9705   void *tmp___0 ;
9703   void *tmp___1 ;   9706   void *tmp___1 ;
9704     9707  
9705   {   9708   {
9706   payload = (Addr )payloadV;   9709   payload = (Addr )payloadV;
9707   if ((SSizeT )new_size < 0L) {   9710   if ((SSizeT )new_size < 0L) {
9708     return ((void *)0);   9711     return ((void *)0);
9709   } else {   9712   } else {
9710     9713  
9711   }   9714   }
9712   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, payload);   9715   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, payload);
9713   md = (MallocMeta *)tmp;   9716   md = (MallocMeta *)tmp;
9714   if (! md) {   9717   if (! md) {
9715     return ((void *)0);   9718     return ((void *)0);
9716   } else {   9719   } else {
9717     9720  
9718   }   9721   }
9719   if (md->payload == payload) {   9722   if (md->payload == payload) {
9720     9723  
9721   } else {   9724   } else {
9722     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == payload",   9725     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == payload",
9723                         (Char const   *)"hg_main.c", 3712,   9726                         (Char const   *)"hg_main.c", 3712,
9724                         (Char const   *)"hg_cli__realloc", "");   9727                         (Char const   *)"hg_cli__realloc", "");
9725   }   9728   }
9726   if (md->szB == new_size) {   9729   if (md->szB == new_size) {
9727     md->where = vgPlain_record_ExeContext(tid, (Word )0);   9730     md->where = vgPlain_record_ExeContext(tid, (Word )0);
9728     return (payloadV);   9731     return (payloadV);
9729   } else {   9732   } else {
9730     9733  
9731   }   9734   }
9732   if (md->szB > new_size) {   9735   if (md->szB > new_size) {
9733     md->szB = new_size;   9736     md->szB = new_size;
9734     md->where = vgPlain_record_ExeContext(tid, (Word )0);   9737     md->where = vgPlain_record_ExeContext(tid, (Word )0);
9735     evh__die_mem_heap(md->payload + new_size, md->szB - new_size);   9738     evh__die_mem_heap(md->payload + new_size, md->szB - new_size);
9736     return (payloadV);   9739     return (payloadV);
9737   } else {   9740   } else {
9738     9741  
9739   }   9742   }
9740   tmp___0 = vgPlain_cli_malloc((SizeT )vgPlain_clo_alignment, new_size);   9743   tmp___0 = vgPlain_cli_malloc((SizeT )vgPlain_clo_alignment, new_size);
9741   p_new = (Addr )tmp___0;   9744   p_new = (Addr )tmp___0;
9742   evh__copy_mem(payload, p_new, md->szB);   9745   evh__copy_mem(payload, p_new, md->szB);
9743   evh__new_mem_heap(p_new + md->szB, new_size - md->szB, (Bool )0);   9746   evh__new_mem_heap(p_new + md->szB, new_size - md->szB, (Bool )0);
9744   evh__die_mem_heap(payload, md->szB);   9747   evh__die_mem_heap(payload, md->szB);
9745   i = (SizeT )0;   9748   i = (SizeT )0;
9746   while (i < md->szB) {   9749   while (i < md->szB) {
9747     *((UChar *)p_new + i) = *((UChar *)payload + i);   9750     *((UChar *)p_new + i) = *((UChar *)payload + i);
9748     i ++;   9751     i ++;
9749   }   9752   }
9750   md_new = new_MallocMeta();   9753   md_new = new_MallocMeta();
9751   *md_new = *md;   9754   *md_new = *md;
9752   tmp___1 = vgPlain_HT_remove(hg_mallocmeta_table, payload);   9755   tmp___1 = vgPlain_HT_remove(hg_mallocmeta_table, payload);
9753   md_tmp = (MallocMeta *)tmp___1;   9756   md_tmp = (MallocMeta *)tmp___1;
9754   if (md_tmp) {   9757   if (md_tmp) {
9755     9758  
9756   } else {   9759   } else {
9757     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp",   9760     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp",
9758                         (Char const   *)"hg_main.c", 3756,   9761                         (Char const   *)"hg_main.c", 3756,
9759                         (Char const   *)"hg_cli__realloc", "");   9762                         (Char const   *)"hg_cli__realloc", "");
9760   }   9763   }
9761   if ((unsigned int )md_tmp == (unsigned int )md) {   9764   if ((unsigned int )md_tmp == (unsigned int )md) {
9762     9765  
9763   } else {   9766   } else {
9764     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp == md",   9767     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp == md",
9765                         (Char const   *)"hg_main.c", 3757,   9768                         (Char const   *)"hg_main.c", 3757,
9766                         (Char const   *)"hg_cli__realloc", "");   9769                         (Char const   *)"hg_cli__realloc", "");
9767   }   9770   }
9768   vgPlain_cli_free((void *)md->payload);   9771   vgPlain_cli_free((void *)md->payload);
9769   delete_MallocMeta(md);   9772   delete_MallocMeta(md);
9770   md_new->where = vgPlain_record_ExeContext(tid, (Word )0);   9773   md_new->where = vgPlain_record_ExeContext(tid, (Word )0);
9771   md_new->szB = new_size;   9774   md_new->szB = new_size;
9772   md_new->payload = p_new;   9775   md_new->payload = p_new;
9773   md_new->thr = map_threads_lookup(tid);   9776   md_new->thr = map_threads_lookup(tid);
9774   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md_new));   9777   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md_new));
9775   return ((void *)p_new);   9778   return ((void *)p_new);
9776 }   9779 }
9777 }   9780 }
9778 static SizeT hg_cli_malloc_usable_size(ThreadId tid , void *p )   9781 static SizeT hg_cli_malloc_usable_size(ThreadId tid , void *p )
9779 {   9782 {
9780   MallocMeta *md ;   9783   MallocMeta *md ;
9781   void *tmp ;   9784   void *tmp ;
9782   SizeT tmp___0 ;   9785   SizeT tmp___0 ;
9783     9786  
9784   {   9787   {
9785   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);   9788   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);
9786   md = (MallocMeta *)tmp;   9789   md = (MallocMeta *)tmp;
9787   if (md) {   9790   if (md) {
9788     tmp___0 = md->szB;   9791     tmp___0 = md->szB;
9789   } else {   9792   } else {
9790     tmp___0 = (SizeT )0;   9793     tmp___0 = (SizeT )0;
9791   }   9794   }
9792   return (tmp___0);   9795   return (tmp___0);
9793 }   9796 }
9794 }   9797 }
9795 __inline static Bool addr_is_in_MM_Chunk(MallocMeta *mm , Addr a )   9798 __inline static Bool addr_is_in_MM_Chunk(MallocMeta *mm , Addr a )
9796 {   9799 {
9797   int tmp ;   9800   int tmp ;
9798   long tmp___0 ;   9801   long tmp___0 ;
9799   long tmp___1 ;   9802   long tmp___1 ;
9800   long tmp___2 ;   9803   long tmp___2 ;
9801     9804  
9802   {   9805   {
9803   if (mm->szB == 0UL) {   9806   if (mm->szB == 0UL) {
9804     if (a == mm->payload) {   9807     if (a == mm->payload) {
9805       tmp = 1;   9808       tmp = 1;
9806     } else {   9809     } else {
9807       tmp = 0;   9810       tmp = 0;
9808     }   9811     }
9809   } else {   9812   } else {
9810     tmp = 0;   9813     tmp = 0;
9811   }   9814   }
9812   tmp___0 = __builtin_expect((long )tmp, 0L);   9815   tmp___0 = __builtin_expect((long )tmp, 0L);
9813   if (tmp___0) {   9816   if (tmp___0) {
9814     return ((Bool )1);   9817     return ((Bool )1);
9815   } else {   9818   } else {
9816     9819  
9817   }   9820   }
9818   tmp___1 = __builtin_expect((long )(! (! (a < mm->payload))), 1L);   9821   tmp___1 = __builtin_expect((long )(! (! (a < mm->payload))), 1L);
9819   if (tmp___1) {   9822   if (tmp___1) {
9820     return ((Bool )0);   9823     return ((Bool )0);
9821   } else {   9824   } else {
9822     9825  
9823   }   9826   }
9824   tmp___2 = __builtin_expect((long )(! (! (a >= mm->payload + mm->szB))), 1L);   9827   tmp___2 = __builtin_expect((long )(! (! (a >= mm->payload + mm->szB))), 1L);
9825   if (tmp___2) {   9828   if (tmp___2) {
9826     return ((Bool )0);   9829     return ((Bool )0);
9827   } else {   9830   } else {
9828     9831  
9829   }   9832   }
9830   return ((Bool )1);   9833   return ((Bool )1);
9831 }   9834 }
9832 }   9835 }
9833 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,   9836 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,
9834                                          SizeT *szB , Addr data_addr )   9837                                          SizeT *szB , Addr data_addr )
9835 {   9838 {
9836   MallocMeta *mm ;   9839   MallocMeta *mm ;
9837   Int i ;   9840   Int i ;
9838   Int n_fast_check_words ;   9841   Int n_fast_check_words ;
9839   void *tmp ;   9842   void *tmp ;
9840   Bool tmp___0 ;   9843   Bool tmp___0 ;
9841   int tmp___1 ;   9844   int tmp___1 ;
9842   long tmp___2 ;   9845   long tmp___2 ;
9843   Bool tmp___3 ;   9846   Bool tmp___3 ;
9844   long tmp___4 ;   9847   long tmp___4 ;
9845   void *tmp___5 ;   9848   void *tmp___5 ;
9846   Bool tmp___6 ;   9849   Bool tmp___6 ;
9847     9850  
9848   {   9851   {
9849   n_fast_check_words = 16;   9852   n_fast_check_words = 16;
9850   i = 0;   9853   i = 0;
9851   while (i < n_fast_check_words) {   9854   while (i < n_fast_check_words) {
9852     tmp = vgPlain_HT_lookup(hg_mallocmeta_table,   9855     tmp = vgPlain_HT_lookup(hg_mallocmeta_table,
9853                             data_addr - (UWord )((UInt )i) * (UWord )sizeof(UWord ));   9856                             data_addr - (UWord )((UInt )i) * (UWord )sizeof(UWord ));
9854     mm = (MallocMeta *)tmp;   9857     mm = (MallocMeta *)tmp;
9855     if (mm) {   9858     if (mm) {
9856       tmp___0 = addr_is_in_MM_Chunk(mm, data_addr);   9859       tmp___0 = addr_is_in_MM_Chunk(mm, data_addr);
9857       if (tmp___0) {   9860       if (tmp___0) {
9858         tmp___1 = 1;   9861         tmp___1 = 1;
9859       } else {   9862       } else {
9860         tmp___1 = 0;   9863         tmp___1 = 0;
9861       }   9864       }
9862     } else {   9865     } else {
9863       tmp___1 = 0;   9866       tmp___1 = 0;
9864     }   9867     }
9865     tmp___2 = __builtin_expect((long )tmp___1, 0L);   9868     tmp___2 = __builtin_expect((long )tmp___1, 0L);
9866     if (tmp___2) {   9869     if (tmp___2) {
9867       goto found;   9870       goto found;
9868     } else {   9871     } else {
9869     9872  
9870     }   9873     }
9871     i ++;   9874     i ++;
9872   }   9875   }
9873   vgPlain_HT_ResetIter(hg_mallocmeta_table);   9876   vgPlain_HT_ResetIter(hg_mallocmeta_table);
9874   while (1) {   9877   while (1) {
9875     tmp___5 = vgPlain_HT_Next(hg_mallocmeta_table);   9878     tmp___5 = vgPlain_HT_Next(hg_mallocmeta_table);
9876     mm = (MallocMeta *)tmp___5;   9879     mm = (MallocMeta *)tmp___5;
9877     if (mm) {   9880     if (mm) {
9878     9881  
9879     } else {   9882     } else {
9880       break;   9883       break;
9881     }   9884     }
9882     tmp___3 = addr_is_in_MM_Chunk(mm, data_addr);   9885     tmp___3 = addr_is_in_MM_Chunk(mm, data_addr);
9883     tmp___4 = __builtin_expect((long )tmp___3, 0L);   9886     tmp___4 = __builtin_expect((long )tmp___3, 0L);
9884     if (tmp___4) {   9887     if (tmp___4) {
9885       goto found;   9888       goto found;
9886     } else {   9889     } else {
9887     9890  
9888     }   9891     }
9889   }   9892   }
9890   return ((Bool )0);   9893   return ((Bool )0);
9891   found:   9894   found:
9892   if (mm) {   9895   if (mm) {
9893     9896  
9894   } else {   9897   } else {
9895     vgPlain_assert_fail((Bool )0, (Char const   *)"mm",   9898     vgPlain_assert_fail((Bool )0, (Char const   *)"mm",
9896                         (Char const   *)"hg_main.c", 3836,   9899                         (Char const   *)"hg_main.c", 3836,
9897                         (Char const   *)"vgHelgrind_mm_find_containing_block",   9900                         (Char const   *)"vgHelgrind_mm_find_containing_block",
9898                         "");   9901                         "");
9899   }   9902   }
9900   tmp___6 = addr_is_in_MM_Chunk(mm, data_addr);   9903   tmp___6 = addr_is_in_MM_Chunk(mm, data_addr);
9901   if (tmp___6) {   9904   if (tmp___6) {
9902     9905  
9903   } else {   9906   } else {
9904     vgPlain_assert_fail((Bool )0,   9907     vgPlain_assert_fail((Bool )0,
9905                         (Char const   *)"addr_is_in_MM_Chunk(mm, data_addr)",   9908                         (Char const   *)"addr_is_in_MM_Chunk(mm, data_addr)",
9906                         (Char const   *)"hg_main.c", 3837,   9909                         (Char const   *)"hg_main.c", 3837,
9907                         (Char const   *)"vgHelgrind_mm_find_containing_block",   9910                         (Char const   *)"vgHelgrind_mm_find_containing_block",
9908                         "");   9911                         "");
9909   }   9912   }
9910   if (where) {   9913   if (where) {
9911     *where = mm->where;   9914     *where = mm->where;
9912   } else {   9915   } else {
9913     9916  
9914   }   9917   }
9915   if (payload) {   9918   if (payload) {
9916     *payload = mm->payload;   9919     *payload = mm->payload;
9917   } else {   9920   } else {
9918     9921  
9919   }   9922   }
9920   if (szB) {   9923   if (szB) {
9921     *szB = mm->szB;   9924     *szB = mm->szB;
9922   } else {   9925   } else {
9923     9926  
9924   }   9927   }
9925   return ((Bool )1);   9928   return ((Bool )1);
9926 }   9929 }
9927 }   9930 }
9928 static void instrument_mem_access(IRSB *bbOut , IRExpr *addr , Int szB ,   9931 static void instrument_mem_access(IRSB *bbOut , IRExpr *addr , Int szB ,
9929                                   Bool isStore , Int hWordTy_szB )   9932                                   Bool isStore , Int hWordTy_szB )
9930 {   9933 {
9931   IRType tyAddr ;   9934   IRType tyAddr ;
9932   HChar *hName ;   9935   HChar *hName ;
9933   void *hAddr ;   9936   void *hAddr ;
9934   Int regparms ;   9937   Int regparms ;
9935   IRExpr **argv ;   9938   IRExpr **argv ;
9936   IRDirty *di ;   9939   IRDirty *di ;
9937   Bool tmp ;   9940   Bool tmp ;
9938   IRExpr *tmp___0 ;   9941   IRExpr *tmp___0 ;
9939   IRExpr *tmp___1 ;   9942   IRExpr *tmp___1 ;
9940   void *tmp___2 ;   9943   void *tmp___2 ;
9941   IRStmt *tmp___3 ;   9944   IRStmt *tmp___3 ;
9942     9945  
9943   {   9946   {
9944   tyAddr = (IRType )69632;   9947   tyAddr = (IRType )69632;
9945   hName = (HChar *)((void *)0);   9948   hName = (HChar *)((void *)0);
9946   hAddr = (void *)0;   9949   hAddr = (void *)0;
9947   regparms = 0;   9950   regparms = 0;
9948   argv = (IRExpr **)((void *)0);   9951   argv = (IRExpr **)((void *)0);
9949   di = (IRDirty *)((void *)0);   9952   di = (IRDirty *)((void *)0);
9950   tmp = isIRAtom(addr);   9953   tmp = isIRAtom(addr);
9951   if (tmp) {   9954   if (tmp) {
9952     9955  
9953   } else {   9956   } else {
9954     vgPlain_assert_fail((Bool )0, (Char const   *)"isIRAtom(addr)",   9957     vgPlain_assert_fail((Bool )0, (Char const   *)"isIRAtom(addr)",
9955                         (Char const   *)"hg_main.c", 3862,   9958                         (Char const   *)"hg_main.c", 3862,
9956                         (Char const   *)"instrument_mem_access", "");   9959                         (Char const   *)"instrument_mem_access", "");
9957   }   9960   }
9958   if (hWordTy_szB == 4) {   9961   if (hWordTy_szB == 4) {
9959     9962  
9960   } else   9963   } else
9961   if (hWordTy_szB == 8) {   9964   if (hWordTy_szB == 8) {
9962     9965  
9963   } else {   9966   } else {
9964     vgPlain_assert_fail((Bool )0,   9967     vgPlain_assert_fail((Bool )0,
9965                         (Char const   *)"hWordTy_szB == 4 || hWordTy_szB == 8",   9968                         (Char const   *)"hWordTy_szB == 4 || hWordTy_szB == 8",
9966                         (Char const   *)"hg_main.c", 3863,   9969                         (Char const   *)"hg_main.c", 3863,
9967                         (Char const   *)"instrument_mem_access", "");   9970                         (Char const   *)"instrument_mem_access", "");
9968   }   9971   }
9969   tyAddr = typeOfIRExpr(bbOut->tyenv, addr);   9972   tyAddr = typeOfIRExpr(bbOut->tyenv, addr);
9970   if ((unsigned int )tyAddr == 69636U) {   9973   if ((unsigned int )tyAddr == 69636U) {
9971     9974  
9972   } else   9975   } else
9973   if ((unsigned int )tyAddr == 69637U) {   9976   if ((unsigned int )tyAddr == 69637U) {
9974     9977  
9975   } else {   9978   } else {
9976     vgPlain_assert_fail((Bool )0,   9979     vgPlain_assert_fail((Bool )0,
9977                         (Char const   *)"tyAddr == Ity_I32 || tyAddr == Ity_I64",   9980                         (Char const   *)"tyAddr == Ity_I32 || tyAddr == Ity_I64",
9978                         (Char const   *)"hg_main.c", 3866,   9981                         (Char const   *)"hg_main.c", 3866,
9979                         (Char const   *)"instrument_mem_access", "");   9982                         (Char const   *)"instrument_mem_access", "");
9980   }   9983   }
9981   regparms = 1;   9984   regparms = 1;
9982   if (isStore) {   9985   if (isStore) {
9983     switch (szB) {   9986     switch (szB) {
9984     case 1:   9987     case 1:
9985     hName = (HChar *)"evh__mem_help_cwrite_1";   9988     hName = (HChar *)"evh__mem_help_cwrite_1";
9986     hAddr = (void *)(& evh__mem_help_cwrite_1);   9989     hAddr = (void *)(& evh__mem_help_cwrite_1);
9987     argv = mkIRExprVec_1(addr);   9990     argv = mkIRExprVec_1(addr);
9988     break;   9991     break;
9989     case 2:   9992     case 2:
9990     hName = (HChar *)"evh__mem_help_cwrite_2";   9993     hName = (HChar *)"evh__mem_help_cwrite_2";
9991     hAddr = (void *)(& evh__mem_help_cwrite_2);   9994     hAddr = (void *)(& evh__mem_help_cwrite_2);
9992     argv = mkIRExprVec_1(addr);   9995     argv = mkIRExprVec_1(addr);
9993     break;   9996     break;
9994     case 4:   9997     case 4:
9995     hName = (HChar *)"evh__mem_help_cwrite_4";   9998     hName = (HChar *)"evh__mem_help_cwrite_4";
9996     hAddr = (void *)(& evh__mem_help_cwrite_4);   9999     hAddr = (void *)(& evh__mem_help_cwrite_4);
9997     argv = mkIRExprVec_1(addr);   10000     argv = mkIRExprVec_1(addr);
9998     break;   10001     break;
9999     case 8:   10002     case 8:
10000     hName = (HChar *)"evh__mem_help_cwrite_8";   10003     hName = (HChar *)"evh__mem_help_cwrite_8";
10001     hAddr = (void *)(& evh__mem_help_cwrite_8);   10004     hAddr = (void *)(& evh__mem_help_cwrite_8);
10002     argv = mkIRExprVec_1(addr);   10005     argv = mkIRExprVec_1(addr);
10003     break;   10006     break;
10004     default:   10007     default:
10005     if (szB > 8) {   10008     if (szB > 8) {
10006       if (szB <= 512) {   10009       if (szB <= 512) {
10007     10010  
10008       } else {   10011       } else {
10009         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10012         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10010                             (Char const   *)"hg_main.c", 3893,   10013                             (Char const   *)"hg_main.c", 3893,
10011                             (Char const   *)"instrument_mem_access", "");   10014                             (Char const   *)"instrument_mem_access", "");
10012       }   10015       }
10013     } else {   10016     } else {
10014       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10017       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10015                           (Char const   *)"hg_main.c", 3893,   10018                           (Char const   *)"hg_main.c", 3893,
10016                           (Char const   *)"instrument_mem_access", "");   10019                           (Char const   *)"instrument_mem_access", "");
10017     }   10020     }
10018     regparms = 2;   10021     regparms = 2;
10019     hName = (HChar *)"evh__mem_help_cwrite_N";   10022     hName = (HChar *)"evh__mem_help_cwrite_N";
10020     hAddr = (void *)(& evh__mem_help_cwrite_N);   10023     hAddr = (void *)(& evh__mem_help_cwrite_N);
10021     tmp___0 = mkIRExpr_HWord((HWord )szB);   10024     tmp___0 = mkIRExpr_HWord((HWord )szB);
10022     argv = mkIRExprVec_2(addr, tmp___0);   10025     argv = mkIRExprVec_2(addr, tmp___0);
10023     break;   10026     break;
10024     }   10027     }
10025   } else {   10028   } else {
10026     switch (szB) {   10029     switch (szB) {
10027     case 1:   10030     case 1:
10028     hName = (HChar *)"evh__mem_help_cread_1";   10031     hName = (HChar *)"evh__mem_help_cread_1";
10029     hAddr = (void *)(& evh__mem_help_cread_1);   10032     hAddr = (void *)(& evh__mem_help_cread_1);
10030     argv = mkIRExprVec_1(addr);   10033     argv = mkIRExprVec_1(addr);
10031     break;   10034     break;
10032     case 2:   10035     case 2:
10033     hName = (HChar *)"evh__mem_help_cread_2";   10036     hName = (HChar *)"evh__mem_help_cread_2";
10034     hAddr = (void *)(& evh__mem_help_cread_2);   10037     hAddr = (void *)(& evh__mem_help_cread_2);
10035     argv = mkIRExprVec_1(addr);   10038     argv = mkIRExprVec_1(addr);
10036     break;   10039     break;
10037     case 4:   10040     case 4:
10038     hName = (HChar *)"evh__mem_help_cread_4";   10041     hName = (HChar *)"evh__mem_help_cread_4";
10039     hAddr = (void *)(& evh__mem_help_cread_4);   10042     hAddr = (void *)(& evh__mem_help_cread_4);
10040     argv = mkIRExprVec_1(addr);   10043     argv = mkIRExprVec_1(addr);
10041     break;   10044     break;
10042     case 8:   10045     case 8:
10043     hName = (HChar *)"evh__mem_help_cread_8";   10046     hName = (HChar *)"evh__mem_help_cread_8";
10044     hAddr = (void *)(& evh__mem_help_cread_8);   10047     hAddr = (void *)(& evh__mem_help_cread_8);
10045     argv = mkIRExprVec_1(addr);   10048     argv = mkIRExprVec_1(addr);
10046     break;   10049     break;
10047     default:   10050     default:
10048     if (szB > 8) {   10051     if (szB > 8) {
10049       if (szB <= 512) {   10052       if (szB <= 512) {
10050     10053  
10051       } else {   10054       } else {
10052         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10055         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10053                             (Char const   *)"hg_main.c", 3923,   10056                             (Char const   *)"hg_main.c", 3923,
10054                             (Char const   *)"instrument_mem_access", "");   10057                             (Char const   *)"instrument_mem_access", "");
10055       }   10058       }
10056     } else {   10059     } else {
10057       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10060       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10058                           (Char const   *)"hg_main.c", 3923,   10061                           (Char const   *)"hg_main.c", 3923,
10059                           (Char const   *)"instrument_mem_access", "");   10062                           (Char const   *)"instrument_mem_access", "");
10060     }   10063     }
10061     regparms = 2;   10064     regparms = 2;
10062     hName = (HChar *)"evh__mem_help_cread_N";   10065     hName = (HChar *)"evh__mem_help_cread_N";
10063     hAddr = (void *)(& evh__mem_help_cread_N);   10066     hAddr = (void *)(& evh__mem_help_cread_N);
10064     tmp___1 = mkIRExpr_HWord((HWord )szB);   10067     tmp___1 = mkIRExpr_HWord((HWord )szB);
10065     argv = mkIRExprVec_2(addr, tmp___1);   10068     argv = mkIRExprVec_2(addr, tmp___1);
10066     break;   10069     break;
10067     }   10070     }
10068   }   10071   }
10069   if (hName) {   10072   if (hName) {
10070     10073  
10071   } else {   10074   } else {
10072     vgPlain_assert_fail((Bool )0, (Char const   *)"hName",   10075     vgPlain_assert_fail((Bool )0, (Char const   *)"hName",
10073                         (Char const   *)"hg_main.c", 3933,   10076                         (Char const   *)"hg_main.c", 3933,
10074                         (Char const   *)"instrument_mem_access", "");   10077                         (Char const   *)"instrument_mem_access", "");
10075   }   10078   }
10076   if (hAddr) {   10079   if (hAddr) {
10077     10080  
10078   } else {   10081   } else {
10079     vgPlain_assert_fail((Bool )0, (Char const   *)"hAddr",   10082     vgPlain_assert_fail((Bool )0, (Char const   *)"hAddr",
10080                         (Char const   *)"hg_main.c", 3934,   10083                         (Char const   *)"hg_main.c", 3934,
10081                         (Char const   *)"instrument_mem_access", "");   10084                         (Char const   *)"instrument_mem_access", "");
10082   }   10085   }
10083   if (argv) {   10086   if (argv) {
10084     10087  
10085   } else {   10088   } else {
10086     vgPlain_assert_fail((Bool )0, (Char const   *)"argv",   10089     vgPlain_assert_fail((Bool )0, (Char const   *)"argv",
10087                         (Char const   *)"hg_main.c", 3935,   10090                         (Char const   *)"hg_main.c", 3935,
10088                         (Char const   *)"instrument_mem_access", "");   10091                         (Char const   *)"instrument_mem_access", "");
10089   }   10092   }
10090   tmp___2 = vgPlain_fnptr_to_fnentry(hAddr);   10093   tmp___2 = vgPlain_fnptr_to_fnentry(hAddr);
10091   di = unsafeIRDirty_0_N(regparms, hName, tmp___2, argv);   10094   di = unsafeIRDirty_0_N(regparms, hName, tmp___2, argv);
10092   tmp___3 = IRStmt_Dirty(di);   10095   tmp___3 = IRStmt_Dirty(di);
10093   addStmtToIRSB(bbOut, tmp___3);   10096   addStmtToIRSB(bbOut, tmp___3);
10094   return;   10097   return;
10095 }   10098 }
10096 }   10099 }
10097 static Bool is_in_dynamic_linker_shared_object(Addr64 ga )   10100 static Bool is_in_dynamic_linker_shared_object(Addr64 ga )
10098 {   10101 {
10099   DebugInfo *dinfo ;   10102   DebugInfo *dinfo ;
10100   UChar const   *soname ;   10103   UChar const   *soname ;
10101   Int tmp ;   10104   Int tmp ;
10102   int tmp___0 ;   10105   int tmp___0 ;
10103   Int tmp___1 ;   10106   Int tmp___1 ;
10104   Int tmp___2 ;   10107   Int tmp___2 ;
10105   int tmp___3 ;   10108   int tmp___3 ;
10106   Int tmp___4 ;   10109   Int tmp___4 ;
10107   Int tmp___5 ;   10110   Int tmp___5 ;
10108   int tmp___6 ;   10111   int tmp___6 ;
10109   Int tmp___7 ;   10112   Int tmp___7 ;
10110   Int tmp___8 ;   10113   Int tmp___8 ;
10111   int tmp___9 ;   10114   int tmp___9 ;
10112   Int tmp___10 ;   10115   Int tmp___10 ;
10113   Int tmp___11 ;   10116   Int tmp___11 ;
10114   int tmp___12 ;   10117   int tmp___12 ;
10115   Int tmp___13 ;   10118   Int tmp___13 ;
10116     10119  
10117   {   10120   {
10118   dinfo = vgPlain_find_DebugInfo((Addr )ga);   10121   dinfo = vgPlain_find_DebugInfo((Addr )ga);
10119   if (! dinfo) {   10122   if (! dinfo) {
10120     return ((Bool )0);   10123     return ((Bool )0);
10121   } else {   10124   } else {
10122     10125  
10123   }   10126   }
10124   soname = vgPlain_DebugInfo_get_soname((DebugInfo const   *)dinfo);   10127   soname = vgPlain_DebugInfo_get_soname((DebugInfo const   *)dinfo);
10125   if (soname) {   10128   if (soname) {
10126     10129  
10127   } else {   10130   } else {
10128     vgPlain_assert_fail((Bool )0, (Char const   *)"soname",   10131     vgPlain_assert_fail((Bool )0, (Char const   *)"soname",
10129                         (Char const   *)"hg_main.c", 3956,   10132                         (Char const   *)"hg_main.c", 3956,
10130                         (Char const   *)"is_in_dynamic_linker_shared_object", "");   10133                         (Char const   *)"is_in_dynamic_linker_shared_object", "");
10131   }   10134   }
10132   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10135   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10133     if ((unsigned int )"ld-linux.so.3" != (unsigned int )((void *)0)) {   10136     if ((unsigned int )"ld-linux.so.3" != (unsigned int )((void *)0)) {
10134       tmp___1 = vgPlain_strcmp((Char const   *)soname,   10137       tmp___1 = vgPlain_strcmp((Char const   *)soname,
10135                                (Char const   *)"ld-linux.so.3");   10138                                (Char const   *)"ld-linux.so.3");
10136       if (tmp___1 == 0) {   10139       if (tmp___1 == 0) {
10137         tmp___0 = (int )((Bool )1);   10140         tmp___0 = (int )((Bool )1);
10138       } else {   10141       } else {
10139         tmp___0 = (int )((Bool )0);   10142         tmp___0 = (int )((Bool )0);
10140       }   10143       }
10141     } else {   10144     } else {
10142       tmp___0 = (int )((Bool )0);   10145       tmp___0 = (int )((Bool )0);
10143     }   10146     }
10144   } else {   10147   } else {
10145     tmp___0 = (int )((Bool )0);   10148     tmp___0 = (int )((Bool )0);
10146   }   10149   }
10147   if (tmp___0) {   10150   if (tmp___0) {
10148     return ((Bool )1);   10151     return ((Bool )1);
10149   } else {   10152   } else {
10150     10153  
10151   }   10154   }
10152   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10155   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10153     if ((unsigned int )"ld-linux.so.2" != (unsigned int )((void *)0)) {   10156     if ((unsigned int )"ld-linux.so.2" != (unsigned int )((void *)0)) {
10154       tmp___4 = vgPlain_strcmp((Char const   *)soname,   10157       tmp___4 = vgPlain_strcmp((Char const   *)soname,
10155                                (Char const   *)"ld-linux.so.2");   10158                                (Char const   *)"ld-linux.so.2");
10156       if (tmp___4 == 0) {   10159       if (tmp___4 == 0) {
10157         tmp___3 = (int )((Bool )1);   10160         tmp___3 = (int )((Bool )1);
10158       } else {   10161       } else {
10159         tmp___3 = (int )((Bool )0);   10162         tmp___3 = (int )((Bool )0);
10160       }   10163       }
10161     } else {   10164     } else {
10162       tmp___3 = (int )((Bool )0);   10165       tmp___3 = (int )((Bool )0);
10163     }   10166     }
10164   } else {   10167   } else {
10165     tmp___3 = (int )((Bool )0);   10168     tmp___3 = (int )((Bool )0);
10166   }   10169   }
10167   if (tmp___3) {   10170   if (tmp___3) {
10168     return ((Bool )1);   10171     return ((Bool )1);
10169   } else {   10172   } else {
10170     10173  
10171   }   10174   }
10172   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10175   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10173     if ((unsigned int )"ld-linux-x86-64.so.2" != (unsigned int )((void *)0)) {   10176     if ((unsigned int )"ld-linux-x86-64.so.2" != (unsigned int )((void *)0)) {
10174       tmp___7 = vgPlain_strcmp((Char const   *)soname,   10177       tmp___7 = vgPlain_strcmp((Char const   *)soname,
10175                                (Char const   *)"ld-linux-x86-64.so.2");   10178                                (Char const   *)"ld-linux-x86-64.so.2");
10176       if (tmp___7 == 0) {   10179       if (tmp___7 == 0) {
10177         tmp___6 = (int )((Bool )1);   10180         tmp___6 = (int )((Bool )1);
10178       } else {   10181       } else {
10179         tmp___6 = (int )((Bool )0);   10182         tmp___6 = (int )((Bool )0);
10180       }   10183       }
10181     } else {   10184     } else {
10182       tmp___6 = (int )((Bool )0);   10185       tmp___6 = (int )((Bool )0);
10183     }   10186     }
10184   } else {   10187   } else {
10185     tmp___6 = (int )((Bool )0);   10188     tmp___6 = (int )((Bool )0);
10186   }   10189   }
10187   if (tmp___6) {   10190   if (tmp___6) {
10188     return ((Bool )1);   10191     return ((Bool )1);
10189   } else {   10192   } else {
10190     10193  
10191   }   10194   }
10192   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10195   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10193     if ((unsigned int )"ld64.so.1" != (unsigned int )((void *)0)) {   10196     if ((unsigned int )"ld64.so.1" != (unsigned int )((void *)0)) {
10194       tmp___10 = vgPlain_strcmp((Char const   *)soname,   10197       tmp___10 = vgPlain_strcmp((Char const   *)soname,
10195                                 (Char const   *)"ld64.so.1");   10198                                 (Char const   *)"ld64.so.1");
10196       if (tmp___10 == 0) {   10199       if (tmp___10 == 0) {
10197         tmp___9 = (int )((Bool )1);   10200         tmp___9 = (int )((Bool )1);
10198       } else {   10201       } else {
10199         tmp___9 = (int )((Bool )0);   10202         tmp___9 = (int )((Bool )0);
10200       }   10203       }
10201     } else {   10204     } else {
10202       tmp___9 = (int )((Bool )0);   10205       tmp___9 = (int )((Bool )0);
10203     }   10206     }
10204   } else {   10207   } else {
10205     tmp___9 = (int )((Bool )0);   10208     tmp___9 = (int )((Bool )0);
10206   }   10209   }
10207   if (tmp___9) {   10210   if (tmp___9) {
10208     return ((Bool )1);   10211     return ((Bool )1);
10209   } else {   10212   } else {
10210     10213  
10211   }   10214   }
10212   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10215   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10213     if ((unsigned int )"ld.so.1" != (unsigned int )((void *)0)) {   10216     if ((unsigned int )"ld.so.1" != (unsigned int )((void *)0)) {
10214       tmp___13 = vgPlain_strcmp((Char const   *)soname,   10217       tmp___13 = vgPlain_strcmp((Char const   *)soname,
10215                                 (Char const   *)"ld.so.1");   10218                                 (Char const   *)"ld.so.1");
10216       if (tmp___13 == 0) {   10219       if (tmp___13 == 0) {
10217         tmp___12 = (int )((Bool )1);   10220         tmp___12 = (int )((Bool )1);
10218       } else {   10221       } else {
10219         tmp___12 = (int )((Bool )0);   10222         tmp___12 = (int )((Bool )0);
10220       }   10223       }
10221     } else {   10224     } else {
10222       tmp___12 = (int )((Bool )0);   10225       tmp___12 = (int )((Bool )0);
10223     }   10226     }
10224   } else {   10227   } else {
10225     tmp___12 = (int )((Bool )0);   10228     tmp___12 = (int )((Bool )0);
10226   }   10229   }
10227   if (tmp___12) {   10230   if (tmp___12) {
10228     return ((Bool )1);   10231     return ((Bool )1);
10229   } else {   10232   } else {
10230     10233  
10231   }   10234   }
10232   return ((Bool )0);   10235   return ((Bool )0);
10233 }   10236 }
10234 }   10237 }
10235 static IRSB *hg_instrument(VgCallbackClosure *closure , IRSB *bbIn ,   10238 static IRSB *hg_instrument(VgCallbackClosure *closure , IRSB *bbIn ,
10236                            VexGuestLayout *layout , VexGuestExtents *vge ,   10239                            VexGuestLayout *layout , VexGuestExtents *vge ,
10237                            IRType gWordTy , IRType hWordTy )   10240                            IRType gWordTy , IRType hWordTy )
10238 {   10241 {
10239   Int i ;   10242   Int i ;
10240   IRSB *bbOut ;   10243   IRSB *bbOut ;
10241   Addr64 cia ;   10244   Addr64 cia ;
10242   IRStmt *st ;   10245   IRStmt *st ;
10243   Bool inLDSO ;   10246   Bool inLDSO ;
10244   Addr64 inLDSOmask4K ;   10247   Addr64 inLDSOmask4K ;
10245   Int tmp ;   10248   Int tmp ;
10246   Bool tmp___0 ;   10249   Bool tmp___0 ;
10247   IRCAS *cas ;   10250   IRCAS *cas ;
10248   Bool isDCAS ;   10251   Bool isDCAS ;
10249   Int tmp___1 ;   10252   Int tmp___1 ;
10250   int tmp___2 ;   10253   int tmp___2 ;
10251   IRType tmp___3 ;   10254   IRType tmp___3 ;
10252   Int tmp___4 ;   10255   Int tmp___4 ;
10253   IRType dataTy ;   10256   IRType dataTy ;
10254   Int tmp___5 ;   10257   Int tmp___5 ;
10255   Int tmp___6 ;   10258   Int tmp___6 ;
10256   Int tmp___7 ;   10259   Int tmp___7 ;
10257   IRType tmp___8 ;   10260   IRType tmp___8 ;
10258   Int tmp___9 ;   10261   Int tmp___9 ;
10259   IRExpr *data ;   10262   IRExpr *data ;
10260   Int tmp___10 ;   10263   Int tmp___10 ;
10261   Int tmp___11 ;   10264   Int tmp___11 ;
10262   Int dataSize ;   10265   Int dataSize ;
10263   IRDirty *d ;   10266   IRDirty *d ;
10264   Int tmp___12 ;   10267   Int tmp___12 ;
10265   Int tmp___13 ;   10268   Int tmp___13 ;
10266     10269  
10267   {   10270   {
10268   inLDSO = (Bool )0;   10271   inLDSO = (Bool )0;
10269   inLDSOmask4K = (Addr64 )1;   10272   inLDSOmask4K = (Addr64 )1;
10270   if ((unsigned int )gWordTy != (unsigned int )hWordTy) {   10273   if ((unsigned int )gWordTy != (unsigned int )hWordTy) {
10271     vgPlain_tool_panic((Char *)"host/guest word size mismatch");   10274     vgPlain_tool_panic((Char *)"host/guest word size mismatch");
10272   } else {   10275   } else {
10273     10276  
10274   }   10277   }
10275   if (1UL << 12 < 4096UL) {   10278   if (1UL << 12 < 4096UL) {
10276     vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");   10279     vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");
10277   } else {   10280   } else {
10278     tmp = vgPlain_log2((UInt )(1UL << 12));   10281     tmp = vgPlain_log2((UInt )(1UL << 12));
10279     if (tmp == -1) {   10282     if (tmp == -1) {
10280       vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");   10283       vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");
10281     } else {   10284     } else {
10282     10285  
10283     }   10286     }
10284   }   10287   }
10285   bbOut = emptyIRSB();   10288   bbOut = emptyIRSB();
10286   bbOut->tyenv = deepCopyIRTypeEnv(bbIn->tyenv);   10289   bbOut->tyenv = deepCopyIRTypeEnv(bbIn->tyenv);
10287   bbOut->next = deepCopyIRExpr(bbIn->next);   10290   bbOut->next = deepCopyIRExpr(bbIn->next);
10288   bbOut->jumpkind = bbIn->jumpkind;   10291   bbOut->jumpkind = bbIn->jumpkind;
10289   i = 0;   10292   i = 0;
10290   while (1) {   10293   while (1) {
10291     if (i < bbIn->stmts_used) {   10294     if (i < bbIn->stmts_used) {
10292       if ((unsigned int )(*(bbIn->stmts + i))->tag != 102401U) {   10295       if ((unsigned int )(*(bbIn->stmts + i))->tag != 102401U) {
10293     10296  
10294       } else {   10297       } else {
10295         break;   10298         break;
10296       }   10299       }
10297     } else {   10300     } else {
10298       break;   10301       break;
10299     }   10302     }
10300     addStmtToIRSB(bbOut, *(bbIn->stmts + i));   10303     addStmtToIRSB(bbOut, *(bbIn->stmts + i));
10301     i ++;   10304     i ++;
10302   }   10305   }
10303   if (bbIn->stmts_used > 0) {   10306   if (bbIn->stmts_used > 0) {
10304     10307  
10305   } else {   10308   } else {
10306     vgPlain_assert_fail((Bool )0, (Char const   *)"bbIn->stmts_used > 0",   10309     vgPlain_assert_fail((Bool )0, (Char const   *)"bbIn->stmts_used > 0",
10307                         (Char const   *)"hg_main.c", 4010,   10310                         (Char const   *)"hg_main.c", 4010,
10308                         (Char const   *)"hg_instrument", "");   10311                         (Char const   *)"hg_instrument", "");
10309   }   10312   }
10310   if (i < bbIn->stmts_used) {   10313   if (i < bbIn->stmts_used) {
10311     10314  
10312   } else {   10315   } else {
10313     vgPlain_assert_fail((Bool )0, (Char const   *)"i < bbIn->stmts_used",   10316     vgPlain_assert_fail((Bool )0, (Char const   *)"i < bbIn->stmts_used",
10314                         (Char const   *)"hg_main.c", 4011,   10317                         (Char const   *)"hg_main.c", 4011,
10315                         (Char const   *)"hg_instrument", "");   10318                         (Char const   *)"hg_instrument", "");
10316   }   10319   }
10317   st = *(bbIn->stmts + i);   10320   st = *(bbIn->stmts + i);
10318   if (102401U == (unsigned int )st->tag) {   10321   if (102401U == (unsigned int )st->tag) {
10319     10322  
10320   } else {   10323   } else {
10321     vgPlain_assert_fail((Bool )0, (Char const   *)"Ist_IMark == st->tag",   10324     vgPlain_assert_fail((Bool )0, (Char const   *)"Ist_IMark == st->tag",
10322                         (Char const   *)"hg_main.c", 4013,   10325                         (Char const   *)"hg_main.c", 4013,
10323                         (Char const   *)"hg_instrument", "");   10326                         (Char const   *)"hg_instrument", "");
10324   }   10327   }
10325   cia = st->Ist.IMark.addr;   10328   cia = st->Ist.IMark.addr;
10326   st = (IRStmt *)((void *)0);   10329   st = (IRStmt *)((void *)0);
10327   while (i < bbIn->stmts_used) {   10330   while (i < bbIn->stmts_used) {
10328     st = *(bbIn->stmts + i);   10331     st = *(bbIn->stmts + i);
10329     if (st) {   10332     if (st) {
10330     10333  
10331     } else {   10334     } else {
10332       vgPlain_assert_fail((Bool )0, (Char const   *)"st",   10335       vgPlain_assert_fail((Bool )0, (Char const   *)"st",
10333                           (Char const   *)"hg_main.c", 4019,   10336                           (Char const   *)"hg_main.c", 4019,
10334                           (Char const   *)"hg_instrument", "");   10337                           (Char const   *)"hg_instrument", "");
10335     }   10338     }
10336     tmp___0 = isFlatIRStmt(st);   10339     tmp___0 = isFlatIRStmt(st);
10337     if (tmp___0) {   10340     if (tmp___0) {
10338     10341  
10339     } else {   10342     } else {
10340       vgPlain_assert_fail((Bool )0, (Char const   *)"isFlatIRStmt(st)",   10343       vgPlain_assert_fail((Bool )0, (Char const   *)"isFlatIRStmt(st)",
10341                           (Char const   *)"hg_main.c", 4020,   10344                           (Char const   *)"hg_main.c", 4020,
10342                           (Char const   *)"hg_instrument", "");   10345                           (Char const   *)"hg_instrument", "");
10343     }   10346     }
10344     switch ((unsigned int )st->tag) {   10347     switch ((unsigned int )st->tag) {
10345     case 102411U:   10348     case 102411U:
10346     case 102404U:   10349     case 102404U:
10347     case 102403U:   10350     case 102403U:
10348     case 102402U:   10351     case 102402U:
10349     case 102400U:   10352     case 102400U:
10350     break;   10353     break;
10351     case 102401U:   10354     case 102401U:
10352     cia = st->Ist.IMark.addr;   10355     cia = st->Ist.IMark.addr;
10353     if ((cia & 0xfffffffffffff000ULL) != inLDSOmask4K) {   10356     if ((cia & 0xfffffffffffff000ULL) != inLDSOmask4K) {
10354       inLDSOmask4K = cia & 0xfffffffffffff000ULL;   10357       inLDSOmask4K = cia & 0xfffffffffffff000ULL;
10355       inLDSO = is_in_dynamic_linker_shared_object(cia);   10358       inLDSO = is_in_dynamic_linker_shared_object(cia);
10356     } else {   10359     } else {
10357     10360  
10358     }   10361     }
10359     break;   10362     break;
10360     case 102410U:   10363     case 102410U:
10361     switch ((unsigned int )st->Ist.MBE.event) {   10364     switch ((unsigned int )st->Ist.MBE.event) {
10362     case 98304U:   10365     case 98304U:
10363     break;   10366     break;
10364     default:   10367     default:
10365     goto unhandled;   10368     goto unhandled;
10366     }   10369     }
10367     break;   10370     break;
10368     case 102407U:   10371     case 102407U:
10369     cas = st->Ist.CAS.details;   10372     cas = st->Ist.CAS.details;
10370     isDCAS = (Bool )(cas->oldHi != 4294967295U);   10373     isDCAS = (Bool )(cas->oldHi != 4294967295U);
10371     if (isDCAS) {   10374     if (isDCAS) {
10372       if (cas->expdHi) {   10375       if (cas->expdHi) {
10373     10376  
10374       } else {   10377       } else {
10375         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->expdHi",   10378         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->expdHi",
10376                             (Char const   *)"hg_main.c", 4064,   10379                             (Char const   *)"hg_main.c", 4064,
10377                             (Char const   *)"hg_instrument", "");   10380                             (Char const   *)"hg_instrument", "");
10378       }   10381       }
10379       if (cas->dataHi) {   10382       if (cas->dataHi) {
10380     10383  
10381       } else {   10384       } else {
10382         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->dataHi",   10385         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->dataHi",
10383                             (Char const   *)"hg_main.c", 4065,   10386                             (Char const   *)"hg_main.c", 4065,
10384                             (Char const   *)"hg_instrument", "");   10387                             (Char const   *)"hg_instrument", "");
10385       }   10388       }
10386     } else {   10389     } else {
10387       if (! cas->expdHi) {   10390       if (! cas->expdHi) {
10388     10391  
10389       } else {   10392       } else {
10390         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->expdHi",   10393         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->expdHi",
10391                             (Char const   *)"hg_main.c", 4067,   10394                             (Char const   *)"hg_main.c", 4067,
10392                             (Char const   *)"hg_instrument", "");   10395                             (Char const   *)"hg_instrument", "");
10393       }   10396       }
10394       if (! cas->dataHi) {   10397       if (! cas->dataHi) {
10395     10398  
10396       } else {   10399       } else {
10397         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->dataHi",   10400         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->dataHi",
10398                             (Char const   *)"hg_main.c", 4068,   10401                             (Char const   *)"hg_main.c", 4068,
10399                             (Char const   *)"hg_instrument", "");   10402                             (Char const   *)"hg_instrument", "");
10400       }   10403       }
10401     }   10404     }
10402     if (! inLDSO) {   10405     if (! inLDSO) {
10403       tmp___1 = sizeofIRType(hWordTy);   10406       tmp___1 = sizeofIRType(hWordTy);
10404       if (isDCAS) {   10407       if (isDCAS) {
10405         tmp___2 = 2;   10408         tmp___2 = 2;
10406       } else {   10409       } else {
10407         tmp___2 = 1;   10410         tmp___2 = 1;
10408       }   10411       }
10409       tmp___3 = typeOfIRExpr(bbIn->tyenv, cas->dataLo);   10412       tmp___3 = typeOfIRExpr(bbIn->tyenv, cas->dataLo);
10410       tmp___4 = sizeofIRType(tmp___3);   10413       tmp___4 = sizeofIRType(tmp___3);
10411       instrument_mem_access(bbOut, cas->addr, tmp___2 * tmp___4, (Bool )0,   10414       instrument_mem_access(bbOut, cas->addr, tmp___2 * tmp___4, (Bool )0,
10412                             tmp___1);   10415                             tmp___1);
10413     } else {   10416     } else {
10414     10417  
10415     }   10418     }
10416     break;   10419     break;
10417     case 102408U:   10420     case 102408U:
10418     if ((unsigned int )st->Ist.LLSC.storedata == (unsigned int )((void *)0)) {   10421     if ((unsigned int )st->Ist.LLSC.storedata == (unsigned int )((void *)0)) {
10419       dataTy = typeOfIRTemp(bbIn->tyenv, st->Ist.LLSC.result);   10422       dataTy = typeOfIRTemp(bbIn->tyenv, st->Ist.LLSC.result);
10420       if (! inLDSO) {   10423       if (! inLDSO) {
10421         tmp___5 = sizeofIRType(hWordTy);   10424         tmp___5 = sizeofIRType(hWordTy);
10422         tmp___6 = sizeofIRType(dataTy);   10425         tmp___6 = sizeofIRType(dataTy);
10423         instrument_mem_access(bbOut, st->Ist.LLSC.addr, tmp___6, (Bool )0,   10426         instrument_mem_access(bbOut, st->Ist.LLSC.addr, tmp___6, (Bool )0,
10424                               tmp___5);   10427                               tmp___5);
10425       } else {   10428       } else {
10426     10429  
10427       }   10430       }
10428     } else {   10431     } else {
10429     10432  
10430     }   10433     }
10431     break;   10434     break;
10432     case 102406U:   10435     case 102406U:
10433     if (! inLDSO) {   10436     if (! inLDSO) {
10434       tmp___7 = sizeofIRType(hWordTy);   10437       tmp___7 = sizeofIRType(hWordTy);
10435       tmp___8 = typeOfIRExpr(bbIn->tyenv, st->Ist.Store.data);   10438       tmp___8 = typeOfIRExpr(bbIn->tyenv, st->Ist.Store.data);
10436       tmp___9 = sizeofIRType(tmp___8);   10439       tmp___9 = sizeofIRType(tmp___8);
10437       instrument_mem_access(bbOut, st->Ist.Store.addr, tmp___9, (Bool )1,   10440       instrument_mem_access(bbOut, st->Ist.Store.addr, tmp___9, (Bool )1,
10438                             tmp___7);   10441                             tmp___7);
10439     } else {   10442     } else {
10440     10443  
10441     }   10444     }
10442     break;   10445     break;
10443     case 102405U:   10446     case 102405U:
10444     data = st->Ist.WrTmp.data;   10447     data = st->Ist.WrTmp.data;
10445     if ((unsigned int )data->tag == 86024U) {   10448     if ((unsigned int )data->tag == 86024U) {
10446       if (! inLDSO) {   10449       if (! inLDSO) {
10447         tmp___10 = sizeofIRType(hWordTy);   10450         tmp___10 = sizeofIRType(hWordTy);
10448         tmp___11 = sizeofIRType(data->Iex.Load.ty);   10451         tmp___11 = sizeofIRType(data->Iex.Load.ty);
10449         instrument_mem_access(bbOut, data->Iex.Load.addr, tmp___11, (Bool )0,   10452         instrument_mem_access(bbOut, data->Iex.Load.addr, tmp___11, (Bool )0,
10450                               tmp___10);   10453                               tmp___10);
10451       } else {   10454       } else {
10452     10455  
10453       }   10456       }
10454     } else {   10457     } else {
10455     10458  
10456     }   10459     }
10457     break;   10460     break;
10458     case 102409U:   10461     case 102409U:
10459     d = st->Ist.Dirty.details;   10462     d = st->Ist.Dirty.details;
10460     if ((unsigned int )d->mFx != 94208U) {   10463     if ((unsigned int )d->mFx != 94208U) {
10461       if ((unsigned int )d->mAddr != (unsigned int )((void *)0)) {   10464       if ((unsigned int )d->mAddr != (unsigned int )((void *)0)) {
10462     10465  
10463       } else {   10466       } else {
10464         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr != NULL",   10467         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr != NULL",
10465                             (Char const   *)"hg_main.c", 4146,   10468                             (Char const   *)"hg_main.c", 4146,
10466                             (Char const   *)"hg_instrument", "");   10469                             (Char const   *)"hg_instrument", "");
10467       }   10470       }
10468       if (d->mSize != 0) {   10471       if (d->mSize != 0) {
10469     10472  
10470       } else {   10473       } else {
10471         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize != 0",   10474         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize != 0",
10472                             (Char const   *)"hg_main.c", 4147,   10475                             (Char const   *)"hg_main.c", 4147,
10473                             (Char const   *)"hg_instrument", "");   10476                             (Char const   *)"hg_instrument", "");
10474       }   10477       }
10475       dataSize = d->mSize;   10478       dataSize = d->mSize;
10476       if ((unsigned int )d->mFx == 94209U) {   10479       if ((unsigned int )d->mFx == 94209U) {
10477         goto _L;   10480         goto _L;
10478       } else   10481       } else
10479       if ((unsigned int )d->mFx == 94211U) {   10482       if ((unsigned int )d->mFx == 94211U) {
10480         _L: /* CIL Label */   10483         _L: /* CIL Label */
10481         if (! inLDSO) {   10484         if (! inLDSO) {
10482           tmp___12 = sizeofIRType(hWordTy);   10485           tmp___12 = sizeofIRType(hWordTy);
10483           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )0, tmp___12);   10486           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )0, tmp___12);
10484         } else {   10487         } else {
10485     10488  
10486         }   10489         }
10487       } else {   10490       } else {
10488     10491  
10489       }   10492       }
10490       if ((unsigned int )d->mFx == 94210U) {   10493       if ((unsigned int )d->mFx == 94210U) {
10491         goto _L___0;   10494         goto _L___0;
10492       } else   10495       } else
10493       if ((unsigned int )d->mFx == 94211U) {   10496       if ((unsigned int )d->mFx == 94211U) {
10494         _L___0: /* CIL Label */   10497         _L___0: /* CIL Label */
10495         if (! inLDSO) {   10498         if (! inLDSO) {
10496           tmp___13 = sizeofIRType(hWordTy);   10499           tmp___13 = sizeofIRType(hWordTy);
10497           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )1, tmp___13);   10500           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )1, tmp___13);
10498         } else {   10501         } else {
10499     10502  
10500         }   10503         }
10501       } else {   10504       } else {
10502     10505  
10503       }   10506       }
10504     } else {   10507     } else {
10505       if ((unsigned int )d->mAddr == (unsigned int )((void *)0)) {   10508       if ((unsigned int )d->mAddr == (unsigned int )((void *)0)) {
10506     10509  
10507       } else {   10510       } else {
10508         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr == NULL",   10511         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr == NULL",
10509                             (Char const   *)"hg_main.c", 4166,   10512                             (Char const   *)"hg_main.c", 4166,
10510                             (Char const   *)"hg_instrument", "");   10513                             (Char const   *)"hg_instrument", "");
10511       }   10514       }
10512       if (d->mSize == 0) {   10515       if (d->mSize == 0) {
10513     10516  
10514       } else {   10517       } else {
10515         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize == 0",   10518         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize == 0",
10516                             (Char const   *)"hg_main.c", 4167,   10519                             (Char const   *)"hg_main.c", 4167,
10517                             (Char const   *)"hg_instrument", "");   10520                             (Char const   *)"hg_instrument", "");
10518       }   10521       }
10519     }   10522     }
10520     break;   10523     break;
10521     unhandled:   10524     unhandled:
10522     default:   10525     default:
10523     ppIRStmt(st);   10526     ppIRStmt(st);
10524     vgPlain_assert_fail((Bool )0, (Char const   *)"0",   10527     vgPlain_assert_fail((Bool )0, (Char const   *)"0",
10525                         (Char const   *)"hg_main.c", 4175,   10528                         (Char const   *)"hg_main.c", 4175,
10526                         (Char const   *)"hg_instrument", "");   10529                         (Char const   *)"hg_instrument", "");
10527     }   10530     }
10528     addStmtToIRSB(bbOut, st);   10531     addStmtToIRSB(bbOut, st);
10529     i ++;   10532     i ++;
10530   }   10533   }
10531   return (bbOut);   10534   return (bbOut);
10532 }   10535 }
10533 }   10536 }
10534 static WordFM *map_pthread_t_to_Thread  =    (WordFM *)((void *)0);   10537 static WordFM *map_pthread_t_to_Thread  =    (WordFM *)((void *)0);
10535 static void map_pthread_t_to_Thread_INIT(void)   10538 static void map_pthread_t_to_Thread_INIT(void)
10536 {   10539 {
10537   long tmp ;   10540   long tmp ;
10538     10541  
10539   {   10542   {
10540   tmp = __builtin_expect((long )((unsigned int )map_pthread_t_to_Thread == (unsigned int )((void *)0)),   10543   tmp = __builtin_expect((long )((unsigned int )map_pthread_t_to_Thread == (unsigned int )((void *)0)),
10541                          0L);   10544                          0L);
10542   if (tmp) {   10545   if (tmp) {
10543     map_pthread_t_to_Thread = vgPlain_newFM(& vgHelgrind_zalloc,   10546     map_pthread_t_to_Thread = vgPlain_newFM(& vgHelgrind_zalloc,
10544                                             (HChar *)"hg.mpttT.1",   10547                                             (HChar *)"hg.mpttT.1",
10545                                             & vgHelgrind_free,   10548                                             & vgHelgrind_free,
10546                                             (Word (*)(UWord  , UWord  ))((void *)0));   10549                                             (Word (*)(UWord  , UWord  ))((void *)0));
10547     if ((unsigned int )map_pthread_t_to_Thread != (unsigned int )((void *)0)) {   10550     if ((unsigned int )map_pthread_t_to_Thread != (unsigned int )((void *)0)) {
10548     10551  
10549     } else {   10552     } else {
10550       vgPlain_assert_fail((Bool )0,   10553       vgPlain_assert_fail((Bool )0,
10551                           (Char const   *)"map_pthread_t_to_Thread != NULL",   10554                           (Char const   *)"map_pthread_t_to_Thread != NULL",
10552                           (Char const   *)"hg_main.c", 4197,   10555                           (Char const   *)"hg_main.c", 4197,
10553                           (Char const   *)"map_pthread_t_to_Thread_INIT", "");   10556                           (Char const   *)"map_pthread_t_to_Thread_INIT", "");
10554     }   10557     }
10555   } else {   10558   } else {
10556     10559  
10557   }   10560   }
10558   return;   10561   return;
10559 }   10562 }
10560 }   10563 }
10561 static Bool hg_handle_client_request(ThreadId tid , UWord *args , UWord *ret )   10564 static Bool hg_handle_client_request(ThreadId tid , UWord *args , UWord *ret )
10562 {   10565 {
10563   Addr payload ;   10566   Addr payload ;
10564   SizeT pszB ;   10567   SizeT pszB ;
10565   Bool tmp ;   10568   Bool tmp ;
10566   Thread *my_thr ;   10569   Thread *my_thr ;
10567   Thread *my_thr___0 ;   10570   Thread *my_thr___0 ;
10568   Thread *thr_q ;   10571   Thread *thr_q ;
10569   Bool found ;   10572   Bool found ;
10570   Bool mutex_is_valid ;   10573   Bool mutex_is_valid ;
10571   Bool tmp___0 ;   10574   Bool tmp___0 ;
10572   HChar *who ;   10575   HChar *who ;
10573   HChar buf[100] ;   10576   HChar buf[100] ;
10574   Thread *thr ;   10577   Thread *thr ;
10575   Thread *tmp___1 ;   10578   Thread *tmp___1 ;
10576   SizeT tmp___2 ;   10579   SizeT tmp___2 ;
10577     10580  
10578   {   10581   {
10579   if (! ((unsigned long )((unsigned int )((72 << 24) | (71 << 16))) == (*(args + 0) & 4294901760UL))) {   10582   if (! ((unsigned long )((unsigned int )((72 << 24) | (71 << 16))) == (*(args + 0) & 4294901760UL))) {
10580     return ((Bool )0);   10583     return ((Bool )0);
10581   } else {   10584   } else {
10582     10585  
10583   }   10586   }
10584   *ret = (UWord )0;   10587   *ret = (UWord )0;
10585   switch (*(args + 0)) {   10588   switch (*(args + 0)) {
10586   case 1212612608UL: ;   10589   case 1212612608UL: ;
10587   if (*(args + 2) > 0UL) {   10590   if (*(args + 2) > 0UL) {
10588     evh__die_mem(*(args + 1), *(args + 2));   10591     evh__die_mem(*(args + 1), *(args + 2));
10589     evh__new_mem(*(args + 1), *(args + 2));   10592     evh__new_mem(*(args + 1), *(args + 2));
10590   } else {   10593   } else {
10591     10594  
10592   }   10595   }
10593   break;   10596   break;
10594   case 1212612906UL:   10597   case 1212612906UL:
10595   payload = (Addr )0;   10598   payload = (Addr )0;
10596   pszB = (SizeT )0;   10599   pszB = (SizeT )0;
10597   tmp = vgHelgrind_mm_find_containing_block((ExeContext **)((void *)0),   10600   tmp = vgHelgrind_mm_find_containing_block((ExeContext **)((void *)0),
10598                                             & payload, & pszB, *(args + 1));   10601                                             & payload, & pszB, *(args + 1));
10599   if (tmp) {   10602   if (tmp) {
10600     if (pszB > 0UL) {   10603     if (pszB > 0UL) {
10601       evh__die_mem(payload, pszB);   10604       evh__die_mem(payload, pszB);
10602       evh__new_mem(payload, pszB);   10605       evh__new_mem(payload, pszB);
10603     } else {   10606     } else {
10604     10607  
10605     }   10608     }
10606     *ret = pszB;   10609     *ret = pszB;
10607   } else {   10610   } else {
10608     *ret = (UWord )-1;   10611     *ret = (UWord )-1;
10609   }   10612   }
10610   break;   10613   break;
10611   case 1212612903UL: ;   10614   case 1212612903UL: ;
10612   if (*(args + 2) > 0UL) {   10615   if (*(args + 2) > 0UL) {
10613     evh__untrack_mem(*(args + 1), *(args + 2));   10616     evh__untrack_mem(*(args + 1), *(args + 2));
10614   } else {   10617   } else {
10615     10618  
10616   }   10619   }
10617   break;   10620   break;
10618   case 1212612904UL: ;   10621   case 1212612904UL: ;
10619   if (*(args + 2) > 0UL) {   10622   if (*(args + 2) > 0UL) {
10620     evh__new_mem(*(args + 1), *(args + 2));   10623     evh__new_mem(*(args + 1), *(args + 2));
10621   } else {   10624   } else {
10622     10625  
10623   }   10626   }
10624   break;   10627   break;
10625   case 1212612864UL:   10628   case 1212612864UL:
10626   my_thr = (Thread *)((void *)0);   10629   my_thr = (Thread *)((void *)0);
10627   map_pthread_t_to_Thread_INIT();   10630   map_pthread_t_to_Thread_INIT();
10628   my_thr = map_threads_maybe_lookup(tid);   10631   my_thr = map_threads_maybe_lookup(tid);
10629   if ((unsigned int )my_thr != (unsigned int )((void *)0)) {   10632   if ((unsigned int )my_thr != (unsigned int )((void *)0)) {
10630     10633  
10631   } else {   10634   } else {
10632     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr != NULL",   10635     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr != NULL",
10633                         (Char const   *)"hg_main.c", 4285,   10636                         (Char const   *)"hg_main.c", 4285,
10634                         (Char const   *)"hg_handle_client_request", "");   10637                         (Char const   *)"hg_handle_client_request", "");
10635   }   10638   }
10636   vgPlain_addToFM(map_pthread_t_to_Thread, (UWord )((Word )*(args + 1)),   10639   vgPlain_addToFM(map_pthread_t_to_Thread, (UWord )((Word )*(args + 1)),
10637                   (UWord )((Word )my_thr));   10640                   (UWord )((Word )my_thr));
10638   break;   10641   break;
10639   case 1212612865UL:   10642   case 1212612865UL:
10640   my_thr___0 = (Thread *)((void *)0);   10643   my_thr___0 = (Thread *)((void *)0);
10641   map_pthread_t_to_Thread_INIT();   10644   map_pthread_t_to_Thread_INIT();
10642   my_thr___0 = map_threads_maybe_lookup(tid);   10645   my_thr___0 = map_threads_maybe_lookup(tid);
10643   if (my_thr___0) {   10646   if (my_thr___0) {
10644     10647  
10645   } else {   10648   } else {
10646     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr",   10649     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr",
10647                         (Char const   *)"hg_main.c", 4299,   10650                         (Char const   *)"hg_main.c", 4299,
10648                         (Char const   *)"hg_handle_client_request", "");   10651                         (Char const   *)"hg_handle_client_request", "");
10649   }   10652   }
10650   vgHelgrind_record_error_PthAPIerror(my_thr___0, (HChar *)*(args + 1),   10653   vgHelgrind_record_error_PthAPIerror(my_thr___0, (HChar *)*(args + 1),
10651                                       (Word )*(args + 2), (HChar *)*(args + 3));   10654                                       (Word )*(args + 2), (HChar *)*(args + 3));
10652   break;   10655   break;
10653   case 1212612866UL:   10656   case 1212612866UL:
10654   thr_q = (Thread *)((void *)0);   10657   thr_q = (Thread *)((void *)0);
10655   found = (Bool )0;   10658   found = (Bool )0;
10656   map_pthread_t_to_Thread_INIT();   10659   map_pthread_t_to_Thread_INIT();
10657   found = vgPlain_lookupFM(map_pthread_t_to_Thread, (UWord *)((void *)0),   10660   found = vgPlain_lookupFM(map_pthread_t_to_Thread, (UWord *)((void *)0),
10658                            (UWord *)((Word *)(& thr_q)),   10661                            (UWord *)((Word *)(& thr_q)),
10659                            (UWord )((Word )*(args + 1)));   10662                            (UWord )((Word )*(args + 1)));
10660   if (found) {   10663   if (found) {
10661     10664  
10662   } else {   10665   } else {
10663     vgPlain_assert_fail((Bool )0, (Char const   *)"found",   10666     vgPlain_assert_fail((Bool )0, (Char const   *)"found",
10664                         (Char const   *)"hg_main.c", 4322,   10667                         (Char const   *)"hg_main.c", 4322,
10665                         (Char const   *)"hg_handle_client_request", "");   10668                         (Char const   *)"hg_handle_client_request", "");
10666   }   10669   }
10667   if (found) {   10670   if (found) {
10668     evh__HG_PTHREAD_JOIN_POST(tid, thr_q);   10671     evh__HG_PTHREAD_JOIN_POST(tid, thr_q);
10669   } else {   10672   } else {
10670     10673  
10671   }   10674   }
10672   break;   10675   break;
10673   case 1212612867UL:   10676   case 1212612867UL:
10674   evh__HG_PTHREAD_MUTEX_INIT_POST(tid, (void *)*(args + 1), (Word )*(args + 2));   10677   evh__HG_PTHREAD_MUTEX_INIT_POST(tid, (void *)*(args + 1), (Word )*(args + 2));
10675   break;   10678   break;
10676   case 1212612868UL:   10679   case 1212612868UL:
10677   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, (void *)*(args + 1));   10680   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, (void *)*(args + 1));
10678   break;   10681   break;
10679   case 1212612869UL:   10682   case 1212612869UL:
10680   evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(tid, (void *)*(args + 1));   10683   evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(tid, (void *)*(args + 1));
10681   break;   10684   break;
10682   case 1212612870UL:   10685   case 1212612870UL:
10683   evh__HG_PTHREAD_MUTEX_UNLOCK_POST(tid, (void *)*(args + 1));   10686   evh__HG_PTHREAD_MUTEX_UNLOCK_POST(tid, (void *)*(args + 1));
10684   break;   10687   break;
10685   case 1212612871UL:   10688   case 1212612871UL:
10686   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));   10689   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));
10687   break;   10690   break;
10688   case 1212612872UL:   10691   case 1212612872UL:
10689   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, (void *)*(args + 1));   10692   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, (void *)*(args + 1));
10690   break;   10693   break;
10691   case 1212612874UL:   10694   case 1212612874UL:
10692   case 1212612873UL:   10695   case 1212612873UL:
10693   evh__HG_PTHREAD_COND_SIGNAL_PRE(tid, (void *)*(args + 1));   10696   evh__HG_PTHREAD_COND_SIGNAL_PRE(tid, (void *)*(args + 1));
10694   break;   10697   break;
10695   case 1212612875UL:   10698   case 1212612875UL:
10696   tmp___0 = evh__HG_PTHREAD_COND_WAIT_PRE(tid, (void *)*(args + 1),   10699   tmp___0 = evh__HG_PTHREAD_COND_WAIT_PRE(tid, (void *)*(args + 1),
10697                                           (void *)*(args + 2));   10700                                           (void *)*(args + 2));
10698   mutex_is_valid = tmp___0;   10701   mutex_is_valid = tmp___0;
10699   if (mutex_is_valid) {   10702   if (mutex_is_valid) {
10700     *ret = (UWord )1;   10703     *ret = (UWord )1;
10701   } else {   10704   } else {
10702     *ret = (UWord )0;   10705     *ret = (UWord )0;
10703   }   10706   }
10704   break;   10707   break;
10705   case 1212612877UL:   10708   case 1212612877UL:
10706   evh__HG_PTHREAD_COND_DESTROY_PRE(tid, (void *)*(args + 1));   10709   evh__HG_PTHREAD_COND_DESTROY_PRE(tid, (void *)*(args + 1));
10707   break;   10710   break;
10708   case 1212612876UL:   10711   case 1212612876UL:
10709   evh__HG_PTHREAD_COND_WAIT_POST(tid, (void *)*(args + 1), (void *)*(args + 2));   10712   evh__HG_PTHREAD_COND_WAIT_POST(tid, (void *)*(args + 1), (void *)*(args + 2));
10710   break;   10713   break;
10711   case 1212612878UL:   10714   case 1212612878UL:
10712   evh__HG_PTHREAD_RWLOCK_INIT_POST(tid, (void *)*(args + 1));   10715   evh__HG_PTHREAD_RWLOCK_INIT_POST(tid, (void *)*(args + 1));
10713   break;   10716   break;
10714   case 1212612879UL:   10717   case 1212612879UL:
10715   evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(tid, (void *)*(args + 1));   10718   evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(tid, (void *)*(args + 1));
10716   break;   10719   break;
10717   case 1212612880UL:   10720   case 1212612880UL:
10718   evh__HG_PTHREAD_RWLOCK_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2),   10721   evh__HG_PTHREAD_RWLOCK_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2),
10719                                   (Word )*(args + 3));   10722                                   (Word )*(args + 3));
10720   break;   10723   break;
10721   case 1212612881UL:   10724   case 1212612881UL:
10722   evh__HG_PTHREAD_RWLOCK_LOCK_POST(tid, (void *)*(args + 1), (Word )*(args + 2));   10725   evh__HG_PTHREAD_RWLOCK_LOCK_POST(tid, (void *)*(args + 1), (Word )*(args + 2));
10723   break;   10726   break;
10724   case 1212612882UL:   10727   case 1212612882UL:
10725   evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(tid, (void *)*(args + 1));   10728   evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(tid, (void *)*(args + 1));
10726   break;   10729   break;
10727   case 1212612883UL:   10730   case 1212612883UL:
10728   evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(tid, (void *)*(args + 1));   10731   evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(tid, (void *)*(args + 1));
10729   break;   10732   break;
10730   case 1212612884UL:   10733   case 1212612884UL:
10731   evh__HG_POSIX_SEM_INIT_POST(tid, (void *)*(args + 1), *(args + 2));   10734   evh__HG_POSIX_SEM_INIT_POST(tid, (void *)*(args + 1), *(args + 2));
10732   break;   10735   break;
10733   case 1212612885UL:   10736   case 1212612885UL:
10734   evh__HG_POSIX_SEM_DESTROY_PRE(tid, (void *)*(args + 1));   10737   evh__HG_POSIX_SEM_DESTROY_PRE(tid, (void *)*(args + 1));
10735   break;   10738   break;
10736   case 1212612886UL:   10739   case 1212612886UL:
10737   evh__HG_POSIX_SEM_POST_PRE(tid, (void *)*(args + 1));   10740   evh__HG_POSIX_SEM_POST_PRE(tid, (void *)*(args + 1));
10738   break;   10741   break;
10739   case 1212612887UL:   10742   case 1212612887UL:
10740   evh__HG_POSIX_SEM_WAIT_POST(tid, (void *)*(args + 1));   10743   evh__HG_POSIX_SEM_WAIT_POST(tid, (void *)*(args + 1));
10741   break;   10744   break;
10742   case 1212612888UL:   10745   case 1212612888UL:
10743   evh__HG_PTHREAD_BARRIER_INIT_PRE(tid, (void *)*(args + 1), *(args + 2),   10746   evh__HG_PTHREAD_BARRIER_INIT_PRE(tid, (void *)*(args + 1), *(args + 2),
10744                                    *(args + 3));   10747                                    *(args + 3));
10745   break;   10748   break;
10746   case 1212612905UL:   10749   case 1212612905UL:
10747   evh__HG_PTHREAD_BARRIER_RESIZE_PRE(tid, (void *)*(args + 1), *(args + 2));   10750   evh__HG_PTHREAD_BARRIER_RESIZE_PRE(tid, (void *)*(args + 1), *(args + 2));
10748   break;   10751   break;
10749   case 1212612889UL:   10752   case 1212612889UL:
10750   evh__HG_PTHREAD_BARRIER_WAIT_PRE(tid, (void *)*(args + 1));   10753   evh__HG_PTHREAD_BARRIER_WAIT_PRE(tid, (void *)*(args + 1));
10751   break;   10754   break;
10752   case 1212612890UL:   10755   case 1212612890UL:
10753   evh__HG_PTHREAD_BARRIER_DESTROY_PRE(tid, (void *)*(args + 1));   10756   evh__HG_PTHREAD_BARRIER_DESTROY_PRE(tid, (void *)*(args + 1));
10754   break;   10757   break;
10755   case 1212612891UL:   10758   case 1212612891UL:
10756   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(tid, (void *)*(args + 1));   10759   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(tid, (void *)*(args + 1));
10757   break;   10760   break;
10758   case 1212612892UL:   10761   case 1212612892UL:
10759   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(tid, (void *)*(args + 1));   10762   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(tid, (void *)*(args + 1));
10760   break;   10763   break;
10761   case 1212612893UL:   10764   case 1212612893UL:
10762   evh__HG_PTHREAD_SPIN_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));   10765   evh__HG_PTHREAD_SPIN_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));
10763   break;   10766   break;
10764   case 1212612894UL:   10767   case 1212612894UL:
10765   evh__HG_PTHREAD_SPIN_LOCK_POST(tid, (void *)*(args + 1));   10768   evh__HG_PTHREAD_SPIN_LOCK_POST(tid, (void *)*(args + 1));
10766   break;   10769   break;
10767   case 1212612895UL:   10770   case 1212612895UL:
10768   evh__HG_PTHREAD_SPIN_DESTROY_PRE(tid, (void *)*(args + 1));   10771   evh__HG_PTHREAD_SPIN_DESTROY_PRE(tid, (void *)*(args + 1));
10769   break;   10772   break;
10770   case 1212612896UL:   10773   case 1212612896UL:
10771   who = (HChar *)*(args + 1);   10774   who = (HChar *)*(args + 1);
10772   tmp___1 = map_threads_maybe_lookup(tid);   10775   tmp___1 = map_threads_maybe_lookup(tid);
10773   thr = tmp___1;   10776   thr = tmp___1;
10774   if (thr) {   10777   if (thr) {
10775     10778  
10776   } else {   10779   } else {
10777     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   10780     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
10778                         (Char const   *)"hg_main.c", 4486,   10781                         (Char const   *)"hg_main.c", 4486,
10779                         (Char const   *)"hg_handle_client_request", "");   10782                         (Char const   *)"hg_handle_client_request", "");
10780   }   10783   }
10781   if (who) {   10784   if (who) {
10782     10785  
10783   } else {   10786   } else {
10784     vgPlain_assert_fail((Bool )0, (Char const   *)"who",   10787     vgPlain_assert_fail((Bool )0, (Char const   *)"who",
10785                         (Char const   *)"hg_main.c", 4487,   10788                         (Char const   *)"hg_main.c", 4487,
10786                         (Char const   *)"hg_handle_client_request", "");   10789                         (Char const   *)"hg_handle_client_request", "");
10787   }   10790   }
10788   tmp___2 = vgPlain_strlen((Char const   *)who);   10791   tmp___2 = vgPlain_strlen((Char const   *)who);
10789   if (tmp___2 <= 50UL) {   10792   if (tmp___2 <= 50UL) {
10790     10793  
10791   } else {   10794   } else {
10792     vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(strlen)(who) <= 50",   10795     vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(strlen)(who) <= 50",
10793                         (Char const   *)"hg_main.c", 4488,   10796                         (Char const   *)"hg_main.c", 4488,
10794                         (Char const   *)"hg_handle_client_request", "");   10797                         (Char const   *)"hg_handle_client_request", "");
10795   }   10798   }
10796   vgPlain_sprintf((Char *)(buf), "Unimplemented client request macro \"%s\"",   10799   vgPlain_sprintf((Char *)(buf), "Unimplemented client request macro \"%s\"",
10797                   who);   10800                   who);
10798   vgHelgrind_record_error_Misc(thr, buf);   10801   vgHelgrind_record_error_Misc(thr, buf);
10799   break;   10802   break;
10800   case 1212612897UL:   10803   case 1212612897UL:
10801   evh__HG_USERSO_SEND_PRE(tid, *(args + 1));   10804   evh__HG_USERSO_SEND_PRE(tid, *(args + 1));
10802   break;   10805   break;
10803   case 1212612898UL:   10806   case 1212612898UL:
10804   evh__HG_USERSO_RECV_POST(tid, *(args + 1));   10807   evh__HG_USERSO_RECV_POST(tid, *(args + 1));
10805   break;   10808   break;
10806   default:   10809   default:
10807   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   10810   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
10808                       (Char const   *)"hg_main.c", 4508,   10811                       (Char const   *)"hg_main.c", 4508,
10809                       (Char const   *)"hg_handle_client_request",   10812                       (Char const   *)"hg_handle_client_request",
10810                       "unhandled Helgrind client request 0x%lx", *(args + 0));   10813                       "unhandled Helgrind client request 0x%lx", *(args + 0));
10811   }   10814   }
10812   return ((Bool )1);   10815   return ((Bool )1);
10813 }   10816 }
10814 }   10817 }
10815 static Bool hg_process_cmd_line_option(Char *arg )   10818 static Bool hg_process_cmd_line_option(Char *arg )
10816 {   10819 {
10817   Char *tmp_str ;   10820   Char *tmp_str ;
10818   Int j ;   10821   Int j ;
10819   SizeT tmp ;   10822   SizeT tmp ;
10820   Bool tmp___0 ;   10823   Bool tmp___0 ;
10821   SizeT tmp___1 ;   10824   SizeT tmp___1 ;
10822   Int tmp___2 ;   10825   Int tmp___2 ;
10823   int tmp___3 ;   10826   int tmp___3 ;
10824   SizeT tmp___4 ;   10827   SizeT tmp___4 ;
10825   Int tmp___5 ;   10828   Int tmp___5 ;
10826   Char *val ;   10829   Char *val ;
10827   SizeT tmp___6 ;   10830   SizeT tmp___6 ;
10828   SizeT tmp___7 ;   10831   SizeT tmp___7 ;
10829   Int tmp___8 ;   10832   Int tmp___8 ;
10830   int tmp___9 ;   10833   int tmp___9 ;
10831   SizeT tmp___10 ;   10834   SizeT tmp___10 ;
10832   Int tmp___11 ;   10835   Int tmp___11 ;
10833   Char *val___0 ;   10836   Char *val___0 ;
10834   SizeT tmp___12 ;   10837   SizeT tmp___12 ;
10835   Char *s ;   10838   Char *s ;
10836   Long n ;   10839   Long n ;
10837   Long tmp___13 ;   10840   Long tmp___13 ;
10838   Int tmp___14 ;   10841   Int tmp___14 ;
10839   int tmp___15 ;   10842   int tmp___15 ;
10840   Int tmp___16 ;   10843   Int tmp___16 ;
10841   Int tmp___17 ;   10844   Int tmp___17 ;
10842   int tmp___18 ;   10845   int tmp___18 ;
10843   Int tmp___19 ;   10846   Int tmp___19 ;
10844   Int tmp___20 ;   10847   Int tmp___20 ;
10845   int tmp___21 ;   10848   int tmp___21 ;
10846   Int tmp___22 ;   10849   Int tmp___22 ;
10847   SizeT tmp___23 ;   10850   SizeT tmp___23 ;
10848   Int tmp___24 ;   10851   Int tmp___24 ;
10849   int tmp___25 ;   10852   int tmp___25 ;
10850   SizeT tmp___26 ;   10853   SizeT tmp___26 ;
10851   Int tmp___27 ;   10854   Int tmp___27 ;
10852   Char *val___1 ;   10855   Char *val___1 ;
10853   SizeT tmp___28 ;   10856   SizeT tmp___28 ;
10854   Int tmp___29 ;   10857   Int tmp___29 ;
10855   int tmp___30 ;   10858   int tmp___30 ;
10856   Int tmp___31 ;   10859   Int tmp___31 ;
10857   Int tmp___32 ;   10860   Int tmp___32 ;
10858   int tmp___33 ;   10861   int tmp___33 ;
10859   Int tmp___34 ;   10862   Int tmp___34 ;
10860   SizeT tmp___35 ;   10863   SizeT tmp___35 ;
10861   Int tmp___36 ;   10864   Int tmp___36 ;
10862   int tmp___37 ;   10865   int tmp___37 ;
10863   SizeT tmp___38 ;   10866   SizeT tmp___38 ;
10864   Int tmp___39 ;   10867   Int tmp___39 ;
10865   Char *val___2 ;   10868   Char *val___2 ;
10866   SizeT tmp___40 ;   10869   SizeT tmp___40 ;
10867   Int tmp___41 ;   10870   Int tmp___41 ;
10868   int tmp___42 ;   10871   int tmp___42 ;
10869   Int tmp___43 ;   10872   Int tmp___43 ;
10870   Int tmp___44 ;   10873   Int tmp___44 ;
10871   int tmp___45 ;   10874   int tmp___45 ;
10872   Int tmp___46 ;   10875   Int tmp___46 ;
10873     10876  
10874   {   10877   {
10875   if ((unsigned int )arg != (unsigned int )((void *)0)) {   10878   if ((unsigned int )arg != (unsigned int )((void *)0)) {
10876     if ((unsigned int )"--track-lockorders=" != (unsigned int )((void *)0)) {   10879     if ((unsigned int )"--track-lockorders=" != (unsigned int )((void *)0)) {
10877       tmp___38 = vgPlain_strlen((Char const   *)"--track-lockorders");   10880       tmp___38 = vgPlain_strlen((Char const   *)"--track-lockorders");
10878       tmp___39 = vgPlain_strncmp((Char const   *)arg,   10881       tmp___39 = vgPlain_strncmp((Char const   *)arg,
10879                                  (Char const   *)"--track-lockorders=",   10882                                  (Char const   *)"--track-lockorders=",
10880                                  tmp___38 + 1UL);   10883                                  tmp___38 + 1UL);
10881       if (tmp___39 == 0) {   10884       if (tmp___39 == 0) {
10882         tmp___37 = (int )((Bool )1);   10885         tmp___37 = (int )((Bool )1);
10883       } else {   10886       } else {
10884         tmp___37 = (int )((Bool )0);   10887         tmp___37 = (int )((Bool )0);
10885       }   10888       }
10886     } else {   10889     } else {
10887       tmp___37 = (int )((Bool )0);   10890       tmp___37 = (int )((Bool )0);
10888     }   10891     }
10889   } else {   10892   } else {
10890     tmp___37 = (int )((Bool )0);   10893     tmp___37 = (int )((Bool )0);
10891   }   10894   }
10892   if (tmp___37) {   10895   if (tmp___37) {
10893     tmp___40 = vgPlain_strlen((Char const   *)"--track-lockorders");   10896     tmp___40 = vgPlain_strlen((Char const   *)"--track-lockorders");
10894     val___2 = arg + (tmp___40 + 1UL);   10897     val___2 = arg + (tmp___40 + 1UL);
10895     if ((unsigned int )val___2 != (unsigned int )((void *)0)) {   10898     if ((unsigned int )val___2 != (unsigned int )((void *)0)) {
10896       if ((unsigned int )"yes" != (unsigned int )((void *)0)) {   10899       if ((unsigned int )"yes" != (unsigned int )((void *)0)) {
10897         tmp___46 = vgPlain_strcmp((Char const   *)val___2, (Char const   *)"yes");   10900         tmp___46 = vgPlain_strcmp((Char const   *)val___2, (Char const   *)"yes");
10898         if (tmp___46 == 0) {   10901         if (tmp___46 == 0) {
10899           tmp___45 = (int )((Bool )1);   10902           tmp___45 = (int )((Bool )1);
10900         } else {   10903         } else {
10901           tmp___45 = (int )((Bool )0);   10904           tmp___45 = (int )((Bool )0);
10902         }   10905         }
10903       } else {   10906       } else {
10904         tmp___45 = (int )((Bool )0);   10907         tmp___45 = (int )((Bool )0);
10905       }   10908       }
10906     } else {   10909     } else {
10907       tmp___45 = (int )((Bool )0);   10910       tmp___45 = (int )((Bool )0);
10908     }   10911     }
10909     if (tmp___45) {   10912     if (tmp___45) {
10910       vgHelgrind_clo_track_lockorders = (Bool )1;   10913       vgHelgrind_clo_track_lockorders = (Bool )1;
10911     } else {   10914     } else {
10912       if ((unsigned int )val___2 != (unsigned int )((void *)0)) {   10915       if ((unsigned int )val___2 != (unsigned int )((void *)0)) {
10913         if ((unsigned int )"no" != (unsigned int )((void *)0)) {   10916         if ((unsigned int )"no" != (unsigned int )((void *)0)) {
10914           tmp___43 = vgPlain_strcmp((Char const   *)val___2,   10917           tmp___43 = vgPlain_strcmp((Char const   *)val___2,
10915                                     (Char const   *)"no");   10918                                     (Char const   *)"no");
10916           if (tmp___43 == 0) {   10919           if (tmp___43 == 0) {
10917             tmp___42 = (int )((Bool )1);   10920             tmp___42 = (int )((Bool )1);
10918           } else {   10921           } else {
10919             tmp___42 = (int )((Bool )0);   10922             tmp___42 = (int )((Bool )0);
10920           }   10923           }
10921         } else {   10924         } else {
10922           tmp___42 = (int )((Bool )0);   10925           tmp___42 = (int )((Bool )0);
10923         }   10926         }
10924       } else {   10927       } else {
10925         tmp___42 = (int )((Bool )0);   10928         tmp___42 = (int )((Bool )0);
10926       }   10929       }
10927       if (tmp___42) {   10930       if (tmp___42) {
10928         vgHelgrind_clo_track_lockorders = (Bool )0;   10931         vgHelgrind_clo_track_lockorders = (Bool )0;
10929       } else {   10932       } else {
10930     10933  
10931       }   10934       }
10932     }   10935     }
10933   } else {   10936   } else {
10934     _L___4: /* CIL Label */   10937     _L___4: /* CIL Label */
10935     if ((unsigned int )arg != (unsigned int )((void *)0)) {   10938     if ((unsigned int )arg != (unsigned int )((void *)0)) {
10936       if ((unsigned int )"--cmp-race-err-addrs=" != (unsigned int )((void *)0)) {   10939       if ((unsigned int )"--cmp-race-err-addrs=" != (unsigned int )((void *)0)) {
10937         tmp___26 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");   10940         tmp___26 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");
10938         tmp___27 = vgPlain_strncmp((Char const   *)arg,   10941         tmp___27 = vgPlain_strncmp((Char const   *)arg,
10939                                    (Char const   *)"--cmp-race-err-addrs=",   10942                                    (Char const   *)"--cmp-race-err-addrs=",
10940                                    tmp___26 + 1UL);   10943                                    tmp___26 + 1UL);
10941         if (tmp___27 == 0) {   10944         if (tmp___27 == 0) {
10942           tmp___25 = (int )((Bool )1);   10945           tmp___25 = (int )((Bool )1);
10943         } else {   10946         } else {
10944           tmp___25 = (int )((Bool )0);   10947           tmp___25 = (int )((Bool )0);
10945         }   10948         }
10946       } else {   10949       } else {
10947         tmp___25 = (int )((Bool )0);   10950         tmp___25 = (int )((Bool )0);
10948       }   10951       }
10949     } else {   10952     } else {
10950       tmp___25 = (int )((Bool )0);   10953       tmp___25 = (int )((Bool )0);
10951     }   10954     }
10952     if (tmp___25) {   10955     if (tmp___25) {
10953       tmp___28 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");   10956       tmp___28 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");
10954       val___1 = arg + (tmp___28 + 1UL);   10957       val___1 = arg + (tmp___28 + 1UL);
10955       if ((unsigned int )val___1 != (unsigned int )((void *)0)) {   10958       if ((unsigned int )val___1 != (unsigned int )((void *)0)) {
10956         if ((unsigned int )"yes" != (unsigned int )((void *)0)) {   10959         if ((unsigned int )"yes" != (unsigned int )((void *)0)) {
10957           tmp___34 = vgPlain_strcmp((Char const   *)val___1,   10960           tmp___34 = vgPlain_strcmp((Char const   *)val___1,
10958                                     (Char const   *)"yes");   10961                                     (Char const   *)"yes");
10959           if (tmp___34 == 0) {   10962           if (tmp___34 == 0) {
10960             tmp___33 = (int )((Bool )1);   10963             tmp___33 = (int )((Bool )1);
10961           } else {   10964           } else {
10962             tmp___33 = (int )((Bool )0);   10965             tmp___33 = (int )((Bool )0);
10963           }   10966           }
10964         } else {   10967         } else {
10965           tmp___33 = (int )((Bool )0);   10968           tmp___33 = (int )((Bool )0);
10966         }   10969         }
10967       } else {   10970       } else {
10968         tmp___33 = (int )((Bool )0);   10971         tmp___33 = (int )((Bool )0);
10969       }   10972       }
10970       if (tmp___33) {   10973       if (tmp___33) {
10971         vgHelgrind_clo_cmp_race_err_addrs = (Bool )1;   10974         vgHelgrind_clo_cmp_race_err_addrs = (Bool )1;
10972       } else {   10975       } else {
10973         if ((unsigned int )val___1 != (unsigned int )((void *)0)) {   10976         if ((unsigned int )val___1 != (unsigned int )((void *)0)) {
10974           if ((unsigned int )"no" != (unsigned int )((void *)0)) {   10977           if ((unsigned int )"no" != (unsigned int )((void *)0)) {
10975             tmp___31 = vgPlain_strcmp((Char const   *)val___1,   10978             tmp___31 = vgPlain_strcmp((Char const   *)val___1,
10976                                       (Char const   *)"no");   10979                                       (Char const   *)"no");
10977             if (tmp___31 == 0) {   10980             if (tmp___31 == 0) {
10978               tmp___30 = (int )((Bool )1);   10981               tmp___30 = (int )((Bool )1);
10979             } else {   10982             } else {
10980               tmp___30 = (int )((Bool )0);   10983               tmp___30 = (int )((Bool )0);
10981             }   10984             }
10982           } else {   10985           } else {
10983             tmp___30 = (int )((Bool )0);   10986             tmp___30 = (int )((Bool )0);
10984           }   10987           }
10985         } else {   10988         } else {
10986           tmp___30 = (int )((Bool )0);   10989           tmp___30 = (int )((Bool )0);
10987         }   10990         }
10988         if (tmp___30) {   10991         if (tmp___30) {
10989           vgHelgrind_clo_cmp_race_err_addrs = (Bool )0;   10992           vgHelgrind_clo_cmp_race_err_addrs = (Bool )0;
10990         } else {   10993         } else {
10991     10994  
10992         }   10995         }
10993       }   10996       }
10994     } else {   10997     } else {
10995       _L___3: /* CIL Label */   10998       _L___3: /* CIL Label */
10996       if ((unsigned int )arg != (unsigned int )((void *)0)) {   10999       if ((unsigned int )arg != (unsigned int )((void *)0)) {
10997         if ((unsigned int )"--history-level=none" != (unsigned int )((void *)0)) {   11000         if ((unsigned int )"--history-level=none" != (unsigned int )((void *)0)) {
10998           tmp___22 = vgPlain_strcmp((Char const   *)arg,   11001           tmp___22 = vgPlain_strcmp((Char const   *)arg,
10999                                     (Char const   *)"--history-level=none");   11002                                     (Char const   *)"--history-level=none");
11000           if (tmp___22 == 0) {   11003           if (tmp___22 == 0) {
11001             tmp___21 = (int )((Bool )1);   11004             tmp___21 = (int )((Bool )1);
11002           } else {   11005           } else {
11003             tmp___21 = (int )((Bool )0);   11006             tmp___21 = (int )((Bool )0);
11004           }   11007           }
11005         } else {   11008         } else {
11006           tmp___21 = (int )((Bool )0);   11009           tmp___21 = (int )((Bool )0);
11007         }   11010         }
11008       } else {   11011       } else {
11009         tmp___21 = (int )((Bool )0);   11012         tmp___21 = (int )((Bool )0);
11010       }   11013       }
11011       if (tmp___21) {   11014       if (tmp___21) {
11012         vgHelgrind_clo_history_level = (UWord )0;   11015         vgHelgrind_clo_history_level = (UWord )0;
11013       } else {   11016       } else {
11014         _L___2: /* CIL Label */   11017         _L___2: /* CIL Label */
11015         if ((unsigned int )arg != (unsigned int )((void *)0)) {   11018         if ((unsigned int )arg != (unsigned int )((void *)0)) {
11016           if ((unsigned int )"--history-level=approx" != (unsigned int )((void *)0)) {   11019           if ((unsigned int )"--history-level=approx" != (unsigned int )((void *)0)) {
11017             tmp___19 = vgPlain_strcmp((Char const   *)arg,   11020             tmp___19 = vgPlain_strcmp((Char const   *)arg,
11018                                       (Char const   *)"--history-level=approx");   11021                                       (Char const   *)"--history-level=approx");
11019             if (tmp___19 == 0) {   11022             if (tmp___19 == 0) {
11020               tmp___18 = (int )((Bool )1);   11023               tmp___18 = (int )((Bool )1);
11021             } else {   11024             } else {
11022               tmp___18 = (int )((Bool )0);   11025               tmp___18 = (int )((Bool )0);
11023             }   11026             }
11024           } else {   11027           } else {
11025             tmp___18 = (int )((Bool )0);   11028             tmp___18 = (int )((Bool )0);
11026           }   11029           }
11027         } else {   11030         } else {
11028           tmp___18 = (int )((Bool )0);   11031           tmp___18 = (int )((Bool )0);
11029         }   11032         }
11030         if (tmp___18) {   11033         if (tmp___18) {
11031           vgHelgrind_clo_history_level = (UWord )1;   11034           vgHelgrind_clo_history_level = (UWord )1;
11032         } else {   11035         } else {
11033           _L___1: /* CIL Label */   11036           _L___1: /* CIL Label */
11034           if ((unsigned int )arg != (unsigned int )((void *)0)) {   11037           if ((unsigned int )arg != (unsigned int )((void *)0)) {
11035             if ((unsigned int )"--history-level=full" != (unsigned int )((void *)0)) {   11038             if ((unsigned int )"--history-level=full" != (unsigned int )((void *)0)) {
11036               tmp___16 = vgPlain_strcmp((Char const   *)arg,   11039               tmp___16 = vgPlain_strcmp((Char const   *)arg,
11037                                         (Char const   *)"--history-level=full");   11040                                         (Char const   *)"--history-level=full");
11038               if (tmp___16 == 0) {   11041               if (tmp___16 == 0) {
11039                 tmp___15 = (int )((Bool )1);   11042                 tmp___15 = (int )((Bool )1);
11040               } else {   11043               } else {
11041                 tmp___15 = (int )((Bool )0);   11044                 tmp___15 = (int )((Bool )0);
11042               }   11045               }
11043             } else {   11046             } else {
11044               tmp___15 = (int )((Bool )0);   11047               tmp___15 = (int )((Bool )0);
11045             }   11048             }
11046           } else {   11049           } else {
11047             tmp___15 = (int )((Bool )0);   11050             tmp___15 = (int )((Bool )0);
11048           }   11051           }
11049           if (tmp___15) {   11052           if (tmp___15) {
11050             vgHelgrind_clo_history_level = (UWord )2;   11053             vgHelgrind_clo_history_level = (UWord )2;
11051           } else {   11054           } else {
11052             _L___0: /* CIL Label */   11055             _L___0: /* CIL Label */
11053             if ((unsigned int )arg != (unsigned int )((void *)0)) {   11056             if ((unsigned int )arg != (unsigned int )((void *)0)) {
11054               if ((unsigned int )"--conflict-cache-size=" != (unsigned int )((void *)0)) {   11057               if ((unsigned int )"--conflict-cache-size=" != (unsigned int )((void *)0)) {
11055                 tmp___10 = vgPlain_strlen((Char const   *)"--conflict-cache-size");   11058                 tmp___10 = vgPlain_strlen((Char const   *)"--conflict-cache-size");
11056                 tmp___11 = vgPlain_strncmp((Char const   *)arg,   11059                 tmp___11 = vgPlain_strncmp((Char const   *)arg,
11057                                            (Char const   *)"--conflict-cache-size=",   11060                                            (Char const   *)"--conflict-cache-size=",
11058                                            tmp___10 + 1UL);   11061                                            tmp___10 + 1UL);
11059                 if (tmp___11 == 0) {   11062                 if (tmp___11 == 0) {
11060                   tmp___9 = (int )((Bool )1);   11063                   tmp___9 = (int )((Bool )1);
11061                 } else {   11064                 } else {
11062                   tmp___9 = (int )((Bool )0);   11065                   tmp___9 = (int )((Bool )0);
11063                 }   11066                 }
11064               } else {   11067               } else {
11065                 tmp___9 = (int )((Bool )0);   11068                 tmp___9 = (int )((Bool )0);
11066               }   11069               }
11067             } else {   11070             } else {
11068               tmp___9 = (int )((Bool )0);   11071               tmp___9 = (int )((Bool )0);
11069             }   11072             }
11070             if (tmp___9) {   11073             if (tmp___9) {
11071               tmp___12 = vgPlain_strlen((Char const   *)"--conflict-cache-size");   11074               tmp___12 = vgPlain_strlen((Char const   *)"--conflict-cache-size");
11072               val___0 = arg + (tmp___12 + 1UL);   11075               val___0 = arg + (tmp___12 + 1UL);
11073               tmp___13 = vgPlain_strtoll10(val___0, & s);   11076               tmp___13 = vgPlain_strtoll10(val___0, & s);
11074               n = tmp___13;   11077               n = tmp___13;
11075               vgHelgrind_clo_conflict_cache_size = (UWord )n;   11078               vgHelgrind_clo_conflict_cache_size = (UWord )n;
11076               if (0 != (int )*(s + 0)) {   11079               if (0 != (int )*(s + 0)) {
11077                 vgPlain_fmsg_bad_option((HChar *)arg, "");   11080                 vgPlain_fmsg_bad_option((HChar *)arg, "");
11078               } else   11081               } else
11079               if ((Long )vgHelgrind_clo_conflict_cache_size != n) {   11082               if ((Long )vgHelgrind_clo_conflict_cache_size != n) {
11080                 vgPlain_fmsg_bad_option((HChar *)arg, "");   11083                 vgPlain_fmsg_bad_option((HChar *)arg, "");
11081               } else {   11084               } else {
11082     11085  
11083               }   11086               }
11084               if (vgHelgrind_clo_conflict_cache_size < 10000UL) {   11087               if (vgHelgrind_clo_conflict_cache_size < 10000UL) {
11085                 vgPlain_fmsg_bad_option((HChar *)arg,   11088                 vgPlain_fmsg_bad_option((HChar *)arg,
11086                                         "\'%s\' argument must be between %lld and %lld\n",   11089                                         "\'%s\' argument must be between %lld and %lld\n",
11087                                         "--conflict-cache-size", (Long )10000,   11090                                         "--conflict-cache-size", (Long )10000,
11088                                         (Long )30000000);   11091                                         (Long )30000000);
11089               } else   11092               } else
11090               if (vgHelgrind_clo_conflict_cache_size > 30000000UL) {   11093               if (vgHelgrind_clo_conflict_cache_size > 30000000UL) {
11091                 vgPlain_fmsg_bad_option((HChar *)arg,   11094                 vgPlain_fmsg_bad_option((HChar *)arg,
11092                                         "\'%s\' argument must be between %lld and %lld\n",   11095                                         "\'%s\' argument must be between %lld and %lld\n",
11093                                         "--conflict-cache-size", (Long )10000,   11096                                         "--conflict-cache-size", (Long )10000,
11094                                         (Long )30000000);   11097                                         (Long )30000000);
11095               } else {   11098               } else {
11096     11099  
11097               }   11100               }
11098             } else {   11101             } else {
11099               _L: /* CIL Label */   11102               _L: /* CIL Label */
11100               if ((unsigned int )arg != (unsigned int )((void *)0)) {   11103               if ((unsigned int )arg != (unsigned int )((void *)0)) {
11101                 if ((unsigned int )"--hg-sanity-flags=" != (unsigned int )((void *)0)) {   11104                 if ((unsigned int )"--hg-sanity-flags=" != (unsigned int )((void *)0)) {
11102                   tmp___4 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");   11105                   tmp___4 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");
11103                   tmp___5 = vgPlain_strncmp((Char const   *)arg,   11106                   tmp___5 = vgPlain_strncmp((Char const   *)arg,
11104                                             (Char const   *)"--hg-sanity-flags=",   11107                                             (Char const   *)"--hg-sanity-flags=",
11105                                             tmp___4 + 1UL);   11108                                             tmp___4 + 1UL);
11106                   if (tmp___5 == 0) {   11109                   if (tmp___5 == 0) {
11107                     tmp___3 = (int )((Bool )1);   11110                     tmp___3 = (int )((Bool )1);
11108                   } else {   11111                   } else {
11109                     tmp___3 = (int )((Bool )0);   11112                     tmp___3 = (int )((Bool )0);
11110                   }   11113                   }
11111                 } else {   11114                 } else {
11112                   tmp___3 = (int )((Bool )0);   11115                   tmp___3 = (int )((Bool )0);
11113                 }   11116                 }
11114               } else {   11117               } else {
11115                 tmp___3 = (int )((Bool )0);   11118                 tmp___3 = (int )((Bool )0);
11116               }   11119               }
11117               if (tmp___3) {   11120               if (tmp___3) {
11118                 tmp___6 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");   11121                 tmp___6 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");
11119                 val = arg + (tmp___6 + 1UL);   11122                 val = arg + (tmp___6 + 1UL);
11120                 tmp_str = val;   11123                 tmp_str = val;
11121                 tmp = vgPlain_strlen((Char const   *)tmp_str);   11124                 tmp = vgPlain_strlen((Char const   *)tmp_str);
11122                 if (6UL != tmp) {   11125                 if (6UL != tmp) {
11123                   vgPlain_message((VgMsgKind )1,   11126                   vgPlain_message((VgMsgKind )1,
11124                                   "--hg-sanity-flags argument must have 6 digits\n");   11127                                   "--hg-sanity-flags argument must have 6 digits\n");
11125                   return ((Bool )0);   11128                   return ((Bool )0);
11126                 } else {   11129                 } else {
11127     11130  
11128                 }   11131                 }
11129                 j = 0;   11132                 j = 0;
11130                 while (j < 6) {   11133                 while (j < 6) {
11131                   if (48 == (int )*(tmp_str + j)) {   11134                   if (48 == (int )*(tmp_str + j)) {
11132     11135  
11133                   } else   11136                   } else
11134                   if (49 == (int )*(tmp_str + j)) {   11137                   if (49 == (int )*(tmp_str + j)) {
11135                     vgHelgrind_clo_sanity_flags |= (long )(1 << (5 - j));   11138                     vgHelgrind_clo_sanity_flags |= (long )(1 << (5 - j));
11136                   } else {   11139                   } else {
11137                     vgPlain_message((VgMsgKind )1,   11140                     vgPlain_message((VgMsgKind )1,
11138                                     "--hg-sanity-flags argument can only contain 0s and 1s\n");   11141                                     "--hg-sanity-flags argument can only contain 0s and 1s\n");
11139                     return ((Bool )0);   11142                     return ((Bool )0);
11140                   }   11143                   }
11141                   j ++;   11144                   j ++;
11142                 }   11145                 }
11143               } else {   11146               } else {
11144                 tmp___0 = vgPlain_replacement_malloc_process_cmd_line_option(arg);   11147                 tmp___0 = vgPlain_replacement_malloc_process_cmd_line_option(arg);
11145                 return (tmp___0);   11148                 return (tmp___0);
11146               }   11149               }
11147             }   11150             }
11148           }   11151           }
11149         }   11152         }
11150       }   11153       }
11151     }   11154     }
11152   }   11155   }
11153   return ((Bool )1);   11156   return ((Bool )1);
11154 }   11157 }
11155 }   11158 }
11156 static void hg_print_usage(void)   11159 static void hg_print_usage(void)
11157 {   11160 {
11158     11161  
11159     11162  
11160   {   11163   {
11161   vgPlain_printf("    --track-lockorders=no|yes show lock ordering errors? [yes]\n    --history-level=none|approx|full [full]\n       full:   show both stack traces for a data race (can be very slow)\n       approx: full trace for one thread, approx for the other (faster)\n       none:   only show trace for one thread in a race (fastest)\n    --conflict-cache-size=N   size of \'full\' history cache [1000000]\n");   11164   vgPlain_printf("    --track-lockorders=no|yes show lock ordering errors? [yes]\n    --history-level=none|approx|full [full]\n       full:   show both stack traces for a data race (can be very slow)\n       approx: full trace for one thread, approx for the other (faster)\n       none:   only show trace for one thread in a race (fastest)\n    --conflict-cache-size=N   size of \'full\' history cache [1000000]\n");
11162   return;   11165   return;
11163 }   11166 }
11164 }   11167 }
11165 static void hg_print_debug_usage(void)   11168 static void hg_print_debug_usage(void)
11166 {   11169 {
11167     11170  
11168     11171  
11169   {   11172   {
11170   vgPlain_printf("    --cmp-race-err-addrs=no|yes  are data addresses in race errors significant? [no]\n");   11173   vgPlain_printf("    --cmp-race-err-addrs=no|yes  are data addresses in race errors significant? [no]\n");
11171   vgPlain_printf("    --hg-sanity-flags=<XXXXXX>   sanity check   at events (X = 0|1) [000000]\n");   11174   vgPlain_printf("    --hg-sanity-flags=<XXXXXX>   sanity check   at events (X = 0|1) [000000]\n");
11172   vgPlain_printf("    --hg-sanity-flags values:\n");   11175   vgPlain_printf("    --hg-sanity-flags values:\n");
11173   vgPlain_printf("       010000   after changes to lock-order-acquisition-graph\n");   11176   vgPlain_printf("       010000   after changes to lock-order-acquisition-graph\n");
11174   vgPlain_printf("       001000   at memory accesses (NB: not currently used)\n");   11177   vgPlain_printf("       001000   at memory accesses (NB: not currently used)\n");
11175   vgPlain_printf("       000100   at mem permission setting for ranges >= %d bytes\n",   11178   vgPlain_printf("       000100   at mem permission setting for ranges >= %d bytes\n",
11176                  256);   11179                  256);
11177   vgPlain_printf("       000010   at lock/unlock events\n");   11180   vgPlain_printf("       000010   at lock/unlock events\n");
11178   vgPlain_printf("       000001   at thread create/join events\n");   11181   vgPlain_printf("       000001   at thread create/join events\n");
11179   return;   11182   return;
11180 }   11183 }
11181 }   11184 }
11182 static void hg_fini(Int exitcode )   11185 static void hg_fini(Int exitcode )
11183 {   11186 {
11184   UWord tmp ;   11187   UWord tmp ;
11185   UWord tmp___0 ;   11188   UWord tmp___0 ;
11186   UWord tmp___1 ;   11189   UWord tmp___1 ;
11187   ULong tmp___2 ;   11190   ULong tmp___2 ;
11188   ULong tmp___3 ;   11191   ULong tmp___3 ;
11189   UWord tmp___4 ;   11192   UWord tmp___4 ;
11190   UWord tmp___5 ;   11193   UWord tmp___5 ;
11191   UWord tmp___6 ;   11194   UWord tmp___6 ;
11192   UWord tmp___7 ;   11195   UWord tmp___7 ;
11193     11196  
11194   {   11197   {
11195   if (vgPlain_clo_verbosity == 1) {   11198   if (vgPlain_clo_verbosity == 1) {
11196     if (! vgPlain_clo_xml) {   11199     if (! vgPlain_clo_xml) {
11197       vgPlain_message((VgMsgKind )1,   11200       vgPlain_message((VgMsgKind )1,
11198                       "For counts of detected and suppressed errors, rerun with: -v\n");   11201                       "For counts of detected and suppressed errors, rerun with: -v\n");
11199     } else {   11202     } else {
11200     11203  
11201     }   11204     }
11202   } else {   11205   } else {
11203     11206  
11204   }   11207   }
11205   if (vgPlain_clo_verbosity == 1) {   11208   if (vgPlain_clo_verbosity == 1) {
11206     if (! vgPlain_clo_xml) {   11209     if (! vgPlain_clo_xml) {
11207       if (vgHelgrind_clo_history_level >= 2UL) {   11210       if (vgHelgrind_clo_history_level >= 2UL) {
11208         vgPlain_umsg("Use --history-level=approx or =none to gain increased speed, at\n");   11211         vgPlain_umsg("Use --history-level=approx or =none to gain increased speed, at\n");
11209         vgPlain_umsg("the cost of reduced accuracy of conflicting-access information\n");   11212         vgPlain_umsg("the cost of reduced accuracy of conflicting-access information\n");
11210       } else {   11213       } else {
11211     11214  
11212       }   11215       }
11213     } else {   11216     } else {
11214     11217  
11215     }   11218     }
11216   } else {   11219   } else {
11217     11220  
11218   }   11221   }
11219   if (vgHelgrind_clo_sanity_flags) {   11222   if (vgHelgrind_clo_sanity_flags) {
11220     all__sanity_check((Char *)"SK_(fini)");   11223     all__sanity_check((Char *)"SK_(fini)");
11221   } else {   11224   } else {
11222     11225  
11223   }   11226   }
11224   if (vgPlain_clo_stats) {   11227   if (vgPlain_clo_stats) {
11225     vgPlain_printf("\n");   11228     vgPlain_printf("\n");
11226     vgHelgrind_ppWSUstats(univ_tsets, (HChar *)"univ_tsets");   11229     vgHelgrind_ppWSUstats(univ_tsets, (HChar *)"univ_tsets");
11227     vgPlain_printf("\n");   11230     vgPlain_printf("\n");
11228     vgHelgrind_ppWSUstats(univ_lsets, (HChar *)"univ_lsets");   11231     vgHelgrind_ppWSUstats(univ_lsets, (HChar *)"univ_lsets");
11229     if (vgHelgrind_clo_track_lockorders) {   11232     if (vgHelgrind_clo_track_lockorders) {
11230       vgPlain_printf("\n");   11233       vgPlain_printf("\n");
11231       vgHelgrind_ppWSUstats(univ_laog, (HChar *)"univ_laog");   11234       vgHelgrind_ppWSUstats(univ_laog, (HChar *)"univ_laog");
11232     } else {   11235     } else {
11233     11236  
11234     }   11237     }
11235     vgPlain_printf("\n");   11238     vgPlain_printf("\n");
11236     tmp = vgHelgrind_cardinalityWSU(univ_lsets);   11239     tmp = vgHelgrind_cardinalityWSU(univ_lsets);
11237     vgPlain_printf("        locksets: %\'8d unique lock sets\n", (Int )tmp);   11240     vgPlain_printf("        locksets: %\'8d unique lock sets\n", (Int )tmp);
11238     tmp___0 = vgHelgrind_cardinalityWSU(univ_tsets);   11241     tmp___0 = vgHelgrind_cardinalityWSU(univ_tsets);
11239     vgPlain_printf("      threadsets: %\'8d unique thread sets\n", (Int )tmp___0);   11242     vgPlain_printf("      threadsets: %\'8d unique thread sets\n", (Int )tmp___0);
11240     if (vgHelgrind_clo_track_lockorders) {   11243     if (vgHelgrind_clo_track_lockorders) {
11241       tmp___1 = vgHelgrind_cardinalityWSU(univ_laog);   11244       tmp___1 = vgHelgrind_cardinalityWSU(univ_laog);
11242       vgPlain_printf("       univ_laog: %\'8d unique lock sets\n", (Int )tmp___1);   11245       vgPlain_printf("       univ_laog: %\'8d unique lock sets\n", (Int )tmp___1);
11243     } else {   11246     } else {
11244     11247  
11245     }   11248     }
11246     tmp___2 = vgHelgrind_stats__LockN_to_P_get_map_size();   11249     tmp___2 = vgHelgrind_stats__LockN_to_P_get_map_size();
11247     vgPlain_printf("  LockN-to-P map: %\'8llu queries (%llu map size)\n",   11250     vgPlain_printf("  LockN-to-P map: %\'8llu queries (%llu map size)\n",
11248                    vgHelgrind_stats__LockN_to_P_queries, tmp___2);   11251                    vgHelgrind_stats__LockN_to_P_queries, tmp___2);
11249     tmp___3 = vgHelgrind_stats__string_table_get_map_size();   11252     tmp___3 = vgHelgrind_stats__string_table_get_map_size();
11250     vgPlain_printf("string table map: %\'8llu queries (%llu map size)\n",   11253     vgPlain_printf("string table map: %\'8llu queries (%llu map size)\n",
11251                    vgHelgrind_stats__string_table_queries, tmp___3);   11254                    vgHelgrind_stats__string_table_queries, tmp___3);
11252     if (vgHelgrind_clo_track_lockorders) {   11255     if (vgHelgrind_clo_track_lockorders) {
11253       if (laog) {   11256       if (laog) {
11254         tmp___4 = vgPlain_sizeFM(laog);   11257         tmp___4 = vgPlain_sizeFM(laog);
11255         tmp___5 = tmp___4;   11258         tmp___5 = tmp___4;
11256       } else {   11259       } else {
11257         tmp___5 = (UWord )0;   11260         tmp___5 = (UWord )0;
11258       }   11261       }
11259       vgPlain_printf("            LAOG: %\'8d map size\n", (Int )tmp___5);   11262       vgPlain_printf("            LAOG: %\'8d map size\n", (Int )tmp___5);
11260       if (laog_exposition) {   11263       if (laog_exposition) {
11261         tmp___6 = vgPlain_sizeFM(laog_exposition);   11264         tmp___6 = vgPlain_sizeFM(laog_exposition);
11262         tmp___7 = tmp___6;   11265         tmp___7 = tmp___6;
11263       } else {   11266       } else {
11264         tmp___7 = (UWord )0;   11267         tmp___7 = (UWord )0;
11265       }   11268       }
11266       vgPlain_printf(" LAOG exposition: %\'8d map size\n", (Int )tmp___7);   11269       vgPlain_printf(" LAOG exposition: %\'8d map size\n", (Int )tmp___7);
11267     } else {   11270     } else {
11268     11271  
11269     }   11272     }
11270     vgPlain_printf("           locks: %\'8lu acquires, %\'lu releases\n",   11273     vgPlain_printf("           locks: %\'8lu acquires, %\'lu releases\n",
11271                    stats__lockN_acquires, stats__lockN_releases);   11274                    stats__lockN_acquires, stats__lockN_releases);
11272     vgPlain_printf("   sanity checks: %\'8lu\n", stats__sanity_checks);   11275     vgPlain_printf("   sanity checks: %\'8lu\n", stats__sanity_checks);
11273     vgPlain_printf("\n");   11276     vgPlain_printf("\n");
11274     libhb_shutdown((Bool )1);   11277     libhb_shutdown((Bool )1);
11275   } else {   11278   } else {
11276     11279  
11277   }   11280   }
11278   return;   11281   return;
11279 }   11282 }
11280 }   11283 }
11281 static void for_libhb__get_stacktrace(Thr *hbt , Addr *frames , UWord nRequest )   11284 static void for_libhb__get_stacktrace(Thr *hbt , Addr *frames , UWord nRequest )
11282 {   11285 {
11283   Thread *thr ;   11286   Thread *thr ;
11284   ThreadId tid ;   11287   ThreadId tid ;
11285   UWord nActual ;   11288   UWord nActual ;
11286   void *tmp ;   11289   void *tmp ;
11287   UInt tmp___0 ;   11290   UInt tmp___0 ;
11288     11291  
11289   {   11292   {
11290   if (hbt) {   11293   if (hbt) {
11291     11294  
11292   } else {   11295   } else {
11293     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",   11296     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",
11294                         (Char const   *)"hg_main.c", 4689,   11297                         (Char const   *)"hg_main.c", 4689,
11295                         (Char const   *)"for_libhb__get_stacktrace", "");   11298                         (Char const   *)"for_libhb__get_stacktrace", "");
11296   }   11299   }
11297   tmp = libhb_get_Thr_hgthread(hbt);   11300   tmp = libhb_get_Thr_hgthread(hbt);
11298   thr = (Thread *)tmp;   11301   thr = (Thread *)tmp;
11299   if (thr) {   11302   if (thr) {
11300     11303  
11301   } else {   11304   } else {
11302     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   11305     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
11303                         (Char const   *)"hg_main.c", 4691,   11306                         (Char const   *)"hg_main.c", 4691,
11304                         (Char const   *)"for_libhb__get_stacktrace", "");   11307                         (Char const   *)"for_libhb__get_stacktrace", "");
11305   }   11308   }
11306   tid = map_threads_maybe_reverse_lookup_SLOW(thr);   11309   tid = map_threads_maybe_reverse_lookup_SLOW(thr);
11307   tmp___0 = vgPlain_get_StackTrace(tid, frames, (UInt )nRequest,   11310   tmp___0 = vgPlain_get_StackTrace(tid, frames, (UInt )nRequest,
11308                                    (StackTrace )((void *)0),   11311                                    (StackTrace )((void *)0),
11309                                    (StackTrace )((void *)0), (Word )0);   11312                                    (StackTrace )((void *)0), (Word )0);
11310   nActual = (UWord )tmp___0;   11313   nActual = (UWord )tmp___0;
11311   if (nActual <= nRequest) {   11314   if (nActual <= nRequest) {
11312     11315  
11313   } else {   11316   } else {
11314     vgPlain_assert_fail((Bool )0, (Char const   *)"nActual <= nRequest",   11317     vgPlain_assert_fail((Bool )0, (Char const   *)"nActual <= nRequest",
11315                         (Char const   *)"hg_main.c", 4695,   11318                         (Char const   *)"hg_main.c", 4695,
11316                         (Char const   *)"for_libhb__get_stacktrace", "");   11319                         (Char const   *)"for_libhb__get_stacktrace", "");
11317   }   11320   }
11318   while (nActual < nRequest) {   11321   while (nActual < nRequest) {
11319     *(frames + nActual) = (Addr )0;   11322     *(frames + nActual) = (Addr )0;
11320     nActual ++;   11323     nActual ++;
11321   }   11324   }
11322   return;   11325   return;
11323 }   11326 }
11324 }   11327 }
11325 static ExeContext *for_libhb__get_EC(Thr *hbt )   11328 static ExeContext *for_libhb__get_EC(Thr *hbt )
11326 {   11329 {
11327   Thread *thr ;   11330   Thread *thr ;
11328   ThreadId tid ;   11331   ThreadId tid ;
11329   ExeContext *ec ;   11332   ExeContext *ec ;
11330   void *tmp ;   11333   void *tmp ;
11331     11334  
11332   {   11335   {
11333   if (hbt) {   11336   if (hbt) {
11334     11337  
11335   } else {   11338   } else {
11336     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",   11339     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",
11337                         (Char const   *)"hg_main.c", 4706,   11340                         (Char const   *)"hg_main.c", 4706,
11338                         (Char const   *)"for_libhb__get_EC", "");   11341                         (Char const   *)"for_libhb__get_EC", "");
11339   }   11342   }
11340   tmp = libhb_get_Thr_hgthread(hbt);   11343   tmp = libhb_get_Thr_hgthread(hbt);
11341   thr = (Thread *)tmp;   11344   thr = (Thread *)tmp;
11342   if (thr) {   11345   if (thr) {
11343     11346  
11344   } else {   11347   } else {
11345     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   11348     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
11346                         (Char const   *)"hg_main.c", 4708,   11349                         (Char const   *)"hg_main.c", 4708,
11347                         (Char const   *)"for_libhb__get_EC", "");   11350                         (Char const   *)"for_libhb__get_EC", "");
11348   }   11351   }
11349   tid = map_threads_maybe_reverse_lookup_SLOW(thr);   11352   tid = map_threads_maybe_reverse_lookup_SLOW(thr);
11350   ec = vgPlain_record_ExeContext(tid, (Word )0);   11353   ec = vgPlain_record_ExeContext(tid, (Word )0);
11351   return (ec);   11354   return (ec);
11352 }   11355 }
11353 }   11356 }
11354 static void hg_post_clo_init(void)   11357 static void hg_post_clo_init(void)
11355 {   11358 {
11356   Thr *hbthr_root ;   11359   Thr *hbthr_root ;
11357     11360  
11358   {   11361   {
11359   hbthr_root = libhb_init(& for_libhb__get_stacktrace, & for_libhb__get_EC);   11362   hbthr_root = libhb_init(& for_libhb__get_stacktrace, & for_libhb__get_EC);
11360   if (vgHelgrind_clo_track_lockorders) {   11363   if (vgHelgrind_clo_track_lockorders) {
11361     laog__init();   11364     laog__init();
11362   } else {   11365   } else {
11363     11366  
11364   }   11367   }
11365   initialise_data_structures(hbthr_root);   11368   initialise_data_structures(hbthr_root);
11366   return;   11369   return;
11367 }   11370 }
11368 }   11371 }
11369 static void hg_pre_clo_init(void)   11372 static void hg_pre_clo_init(void)
11370 {   11373 {
11371     11374  
11372     11375  
11373   {   11376   {
11374   vgPlain_details_name((Char *)"Helgrind");   11377   vgPlain_details_name((Char *)"Helgrind");
11375   vgPlain_details_version((Char *)((void *)0));   11378   vgPlain_details_version((Char *)((void *)0));
11376   vgPlain_details_description((Char *)"a thread error detector");   11379   vgPlain_details_description((Char *)"a thread error detector");
11377   vgPlain_details_copyright_author((Char *)"Copyright (C) 2007-2010, and GNU GPL\'d, by OpenWorks LLP et al.");   11380   vgPlain_details_copyright_author((Char *)"Copyright (C) 2007-2010, and GNU GPL\'d, by OpenWorks LLP et al.");
11378   vgPlain_details_bug_reports_to((Char *)"www.valgrind.org");   11381   vgPlain_details_bug_reports_to((Char *)"www.valgrind.org");
11379   vgPlain_details_avg_translation_sizeB((UInt )320);   11382   vgPlain_details_avg_translation_sizeB((UInt )320);
11380   vgPlain_basic_tool_funcs(& hg_post_clo_init, & hg_instrument, & hg_fini);   11383   vgPlain_basic_tool_funcs(& hg_post_clo_init, & hg_instrument, & hg_fini);
11381   vgPlain_needs_core_errors();   11384   vgPlain_needs_core_errors();
11382   vgPlain_needs_tool_errors(& vgHelgrind_eq_Error, & vgHelgrind_before_pp_Error,   11385   vgPlain_needs_tool_errors(& vgHelgrind_eq_Error, & vgHelgrind_before_pp_Error,
11383                             & vgHelgrind_pp_Error, (Bool )0,   11386                             & vgHelgrind_pp_Error, (Bool )0,
11384                             & vgHelgrind_update_extra,   11387                             & vgHelgrind_update_extra,
11385                             & vgHelgrind_recognised_suppression,   11388                             & vgHelgrind_recognised_suppression,
11386                             & vgHelgrind_read_extra_suppression_info,   11389                             & vgHelgrind_read_extra_suppression_info,
11387                             & vgHelgrind_error_matches_suppression,   11390                             & vgHelgrind_error_matches_suppression,
11388                             & vgHelgrind_get_error_name,   11391                             & vgHelgrind_get_error_name,
11389                             & vgHelgrind_get_extra_suppression_info);   11392                             & vgHelgrind_get_extra_suppression_info);
11390   vgPlain_needs_xml_output();   11393   vgPlain_needs_xml_output();
11391   vgPlain_needs_command_line_options(& hg_process_cmd_line_option,   11394   vgPlain_needs_command_line_options(& hg_process_cmd_line_option,
11392                                      & hg_print_usage, & hg_print_debug_usage);   11395                                      & hg_print_usage, & hg_print_debug_usage);
11393   vgPlain_needs_client_requests(& hg_handle_client_request);   11396   vgPlain_needs_client_requests(& hg_handle_client_request);
11394   vgPlain_needs_malloc_replacement(& hg_cli__malloc, & hg_cli____builtin_new,   11397   vgPlain_needs_malloc_replacement(& hg_cli__malloc, & hg_cli____builtin_new,
11395                                    & hg_cli____builtin_vec_new,   11398                                    & hg_cli____builtin_vec_new,
11396                                    & hg_cli__memalign, & hg_cli__calloc,   11399                                    & hg_cli__memalign, & hg_cli__calloc,
11397                                    & hg_cli__free, & hg_cli____builtin_delete,   11400                                    & hg_cli__free, & hg_cli____builtin_delete,
11398                                    & hg_cli____builtin_vec_delete,   11401                                    & hg_cli____builtin_vec_delete,
11399                                    & hg_cli__realloc,   11402                                    & hg_cli__realloc,
11400                                    & hg_cli_malloc_usable_size, (SizeT )16);   11403                                    & hg_cli_malloc_usable_size, (SizeT )16);
11401   vgPlain_track_new_mem_startup(& evh__new_mem_w_perms);   11404   vgPlain_track_new_mem_startup(& evh__new_mem_w_perms);
11402   vgPlain_track_new_mem_stack_signal(& evh__new_mem_w_tid);   11405   vgPlain_track_new_mem_stack_signal(& evh__new_mem_w_tid);
11403   vgPlain_track_new_mem_brk(& evh__new_mem_w_tid);   11406   vgPlain_track_new_mem_brk(& evh__new_mem_w_tid);
11404   vgPlain_track_new_mem_mmap(& evh__new_mem_w_perms);   11407   vgPlain_track_new_mem_mmap(& evh__new_mem_w_perms);
11405   vgPlain_track_new_mem_stack(& evh__new_mem_stack);   11408   vgPlain_track_new_mem_stack(& evh__new_mem_stack);
11406   vgPlain_track_copy_mem_remap(& evh__copy_mem);   11409   vgPlain_track_copy_mem_remap(& evh__copy_mem);
11407   vgPlain_track_change_mem_mprotect(& evh__set_perms);   11410   vgPlain_track_change_mem_mprotect(& evh__set_perms);
11408   vgPlain_track_die_mem_stack_signal(& evh__die_mem);   11411   vgPlain_track_die_mem_stack_signal(& evh__die_mem);
11409   vgPlain_track_die_mem_brk(& evh__die_mem);   11412   vgPlain_track_die_mem_brk(& evh__die_mem);
11410   vgPlain_track_die_mem_munmap(& evh__die_mem);   11413   vgPlain_track_die_mem_munmap(& evh__die_mem);
11411   vgPlain_track_die_mem_stack(& evh__die_mem);   11414   vgPlain_track_die_mem_stack(& evh__die_mem);
11412   vgPlain_track_ban_mem_stack((void (*)(Addr a , SizeT len ))((void *)0));   11415   vgPlain_track_ban_mem_stack((void (*)(Addr a , SizeT len ))((void *)0));
11413   vgPlain_track_pre_mem_read(& evh__pre_mem_read);   11416   vgPlain_track_pre_mem_read(& evh__pre_mem_read);
11414   vgPlain_track_pre_mem_read_asciiz(& evh__pre_mem_read_asciiz);   11417   vgPlain_track_pre_mem_read_asciiz(& evh__pre_mem_read_asciiz);
11415   vgPlain_track_pre_mem_write(& evh__pre_mem_write);   11418   vgPlain_track_pre_mem_write(& evh__pre_mem_write);
11416   vgPlain_track_post_mem_write((void (*)(CorePart part , ThreadId tid , Addr a ,   11419   vgPlain_track_post_mem_write((void (*)(CorePart part , ThreadId tid , Addr a ,
11417                                          SizeT size ))((void *)0));   11420                                          SizeT size ))((void *)0));
11418   vgPlain_track_pre_thread_ll_create(& evh__pre_thread_ll_create);   11421   vgPlain_track_pre_thread_ll_create(& evh__pre_thread_ll_create);
11419   vgPlain_track_pre_thread_ll_exit(& evh__pre_thread_ll_exit);   11422   vgPlain_track_pre_thread_ll_exit(& evh__pre_thread_ll_exit);
11420   vgPlain_track_start_client_code(& evh__start_client_code);   11423   vgPlain_track_start_client_code(& evh__start_client_code);
11421   vgPlain_track_stop_client_code(& evh__stop_client_code);   11424   vgPlain_track_stop_client_code(& evh__stop_client_code);
11422   if (sizeof(void *) == sizeof(struct _MallocMeta *)) {   11425   if (sizeof(void *) == sizeof(struct _MallocMeta *)) {
11423     11426  
11424   } else {   11427   } else {
11425     vgPlain_assert_fail((Bool )0,   11428     vgPlain_assert_fail((Bool )0,
11426                         (Char const   *)"sizeof(void*) == sizeof(struct _MallocMeta*)",   11429                         (Char const   *)"sizeof(void*) == sizeof(struct _MallocMeta*)",
11427                         (Char const   *)"hg_main.c", 4822,   11430                         (Char const   *)"hg_main.c", 4822,
11428                         (Char const   *)"hg_pre_clo_init", "");   11431                         (Char const   *)"hg_pre_clo_init", "");
11429   }   11432   }
11430   if (sizeof(UWord ) == sizeof(Addr )) {   11433   if (sizeof(UWord ) == sizeof(Addr )) {
11431     11434  
11432   } else {   11435   } else {
11433     vgPlain_assert_fail((Bool )0,   11436     vgPlain_assert_fail((Bool )0,
11434                         (Char const   *)"sizeof(UWord) == sizeof(Addr)",   11437                         (Char const   *)"sizeof(UWord) == sizeof(Addr)",
11435                         (Char const   *)"hg_main.c", 4823,   11438                         (Char const   *)"hg_main.c", 4823,
11436                         (Char const   *)"hg_pre_clo_init", "");   11439                         (Char const   *)"hg_pre_clo_init", "");
11437   }   11440   }
11438   hg_mallocmeta_table = vgPlain_HT_construct((HChar *)"hg_malloc_metadata_table");   11441   hg_mallocmeta_table = vgPlain_HT_construct((HChar *)"hg_malloc_metadata_table");
11439   vgPlain_atfork((void (*)(ThreadId  ))((void *)0),   11442   vgPlain_atfork((void (*)(ThreadId  ))((void *)0),
11440                  (void (*)(ThreadId  ))((void *)0), & evh__atfork_child);   11443                  (void (*)(ThreadId  ))((void *)0), & evh__atfork_child);
11441   return;   11444   return;
11442 }   11445 }
11443 }   11446 }
11444 void (*vgPlain_tl_pre_clo_init)(void)  =    & hg_pre_clo_init;   11447 void (*vgPlain_tl_pre_clo_init)(void)  =    & hg_pre_clo_init;